module Ruote::Resque::Job

Include this module inside your Resque jobs to enable them to respond to Ruote.

@example

class MyAwesomeJob
  extend Ruote::Resque::Job

  def self.perform(workitem)
    workitem['fields']['awesome'] = true
  end
end

Public Instance Methods

after_perform_reply_to_ruote(workitem) click to toggle source

after_perform hook to send a reply to the Ruote process. @param [Hash] workitem the workitem sent to the current Job @return [void]

# File lib/ruote/resque/job.rb, line 25
def after_perform_reply_to_ruote(workitem)
  Ruote::Resque.reply(workitem)
end
on_failure_reply_to_ruote(exception, workitem) click to toggle source

on_failure hook to send a reply to the Ruote process. Will collect the exception details and send them along. @param [Exception] exception the raised exception @param [Hash] workitem the workitem sent to the current Job.

TODO: this may be mutated from the original workitem, handle it.

@return [void]

# File lib/ruote/resque/job.rb, line 35
def on_failure_reply_to_ruote(exception, workitem)

  klass = exception.class.to_s
  message = exception.message
  backtrace = exception.backtrace

  Ruote::Resque.reply(klass, message, backtrace, workitem)
end