Resque Queueable
April 24 2012 at 03:27 pm
Resque is a cool thing. It uses Redis to let you background tasks in a very fast and clean way. Read up on it if you don't already know it.
The standard pattern was to create an async_whatever method to background each specific method call, and include the object id so ActiveRecord can retrieve your instance for you later.
I just wrote the Resque Queueable gem to automate this pattern. You can mark your model as 'resqueable', then call the method on the instance queue. This will queue the call for you and let Resque do its thing.
Example:
It's available on GitHub of course:
http://github.com/kimos/resque-queueable
The standard pattern was to create an async_whatever method to background each specific method call, and include the object id so ActiveRecord can retrieve your instance for you later.
I just wrote the Resque Queueable gem to automate this pattern. You can mark your model as 'resqueable', then call the method on the instance queue. This will queue the call for you and let Resque do its thing.
Example:
class Something
resqueable
def the_method(arg)
...
end
end
Something.last.queue.the_method(123)
It's available on GitHub of course:
http://github.com/kimos/resque-queueable