Reputation: 89
I'm working on a rails app which involves using Resque. I have my queue defined in the worker class.
def self.queue
@queue = :my_worker_queue
end
However I'm still getting
Jobs must be placed onto a queue. No queue could be inferred for class Worker
Any ideas about how a queue should be defined? Thanks!
Upvotes: 0
Views: 1673
Reputation: 759
Resque requires you to set the class-level instance variable with the queue name. That's what your self.queue
method does, but it'll only do it if you actually call it.
The easier option is to remove the self.queue
method and put @queue = :my_worker_queue
at the top of the class itself.
So it would be something like
class Worker
@queue = :my_worker_queue
def self.perform
# do your stuff
end
end
More information: http://tutorials.jumpstartlab.com/topics/performance/background_jobs.html
Upvotes: 4