I am trying Rabbitmq and sneakers for the first time. And I am facing some issues when i try to run my workers. I have added the following line in application.rb
config.active_job.queue_adapter = :sneakers
And when i run rake --tasks, sneakers is not listed
This is my sneakers.rb file
require 'sneakers'
Sneakers.configure connection: Bunny.new(
addresses: 'localhost:5672',
username: 'guest',
password: 'guest',
vhost: '/',
logger: Rails.logger
),
exchange: 'sneakers',
exchange_type: :direct,
workers: 1,
env: ENV['RAILS_ENV'],
durable: true,
ack: true,
heartbeat: 30
Sneakers.logger = Rails.logger
Sneakers.logger.level = Logger::WARN
Rails version - 4.2.4. Ruby version - 2.3.3. Sneakers version - 2.11.0
I am stuck here. Any solutions or any docs for reference will also be helpful.
You're supposed to add
require 'sneakers/tasks'
to your Rakefile, once you do that rake -T will show the sneakers tasks. To start workers you can:Also I ran into a strange issue: the sneakers rake task would sometimes error out with "no workers found", not sure whether its a Rails autoloading issue or not, but the solution is to create another rake task of your own where you instantiate each of your worker classes and then invoke the sneakers:run task: