Class: Qmin::Strategy::Resque
- Inherits:
-
Object
- Object
- Qmin::Strategy::Resque
- Defined in:
- lib/qmin/strategy/resque.rb
Overview
Strategy to handle background calls and queuing of worker jobs with Resque This will only be available if the Resque constant is defined when you require ‘qmin’ If somehow this is not working for you, add:
require 'qmin/resque/background_call_job'
require 'qmin/resque/base_job'
require 'qmin/strategy/resque'
where needed
Methods that are annotated with “background_method” will be handled by the generic Qmin::Resque::BackgroundCallJob worker. It will automatically create a queue name based on the class and method it is working on.
So for example:
-
Jobs::Profile#update_facebook_friends is annotated to be a background_method
-
‘qmin_resque_background_call_job_jobs_profile_update_facebook_friends’ will be the queue name
Instance Method Summary collapse
-
#background_call(instance, method_name) ⇒ Object
Queue name is based on worker class and method name By default Qmin::Resque::BackgroundCallJob will handle jobs.
-
#enqueue(worker_class, *args) ⇒ Object
Just passes.
Instance Method Details
#background_call(instance, method_name) ⇒ Object
Queue name is based on worker class and method name By default Qmin::Resque::BackgroundCallJob will handle jobs
29 30 31 |
# File 'lib/qmin/strategy/resque.rb', line 29 def background_call(instance, method_name) ::Resque.enqueue_to(queue_name(instance.class.name, method_name), self.class.job_class, instance.class.name, method_name, instance.id) end |
#enqueue(worker_class, *args) ⇒ Object
Just passes
22 23 24 |
# File 'lib/qmin/strategy/resque.rb', line 22 def enqueue(worker_class, *args) ::Resque.enqueue worker_class, *args end |