Class: Backgrounded::Resque::ResqueHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/backgrounded-resque/resque_handler.rb

Constant Summary collapse

DEFAULT_QUEUE =
'backgrounded'
INVALID_ID =
-1

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.perform(clazz, id, method, *args) ⇒ Object

invoke the requested method fired from the resque workers



27
28
29
# File 'lib/backgrounded-resque/resque_handler.rb', line 27

def self.perform(clazz, id, method, *args)
  find_instance(clazz, id, method).send(method, *args)
end

Instance Method Details

#request(object, method, args, options = {}) ⇒ Object

enqueue the requested operation into resque the resque worker will invoke .perform with the class/method/args

See Also:



19
20
21
22
23
# File 'lib/backgrounded-resque/resque_handler.rb', line 19

def request(object, method, args, options={})
  ResqueHandler.queue = options[:queue] || DEFAULT_QUEUE
  instance, id = instance_identifiers(object)
  ::Resque.enqueue(ResqueHandler, instance, id, method, *args)
end