I have next code:
# Gemfile
gem 'sneakers'
# application.rb
config.active_job.queue_adapter = :sneakers
# application_mailer.rb
class ApplicationMailer < ActionMailer::Base
...
def send_letter(params={})
mail(params)
...
end
end
# my_mailer_controller.rb
def send_my_mail
ApplicationMailer.send_letter(params).deliver_later
end
rabbitmq-server is installed and started. When I run 'send_my_mail' function I receive in Rails console message:
[ActiveJob] Enqueued ActionMailer::DeliveryJob (Job ID: b2c66a30-70d1-4bba-a88e-d6260443347d) to Sneakers(mailers) with arguments: "ApplicationMailer", "send_letter", "deliver_now", ...
But when I run ActiveJob worker using terminal command:
WORKERS=ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper rake sneakers:run
nothing happens. Looks like the mailer listener with correct class name does not start so the letters are not sent. In Rabbitmq UI tracer I see record for message event:
Node: rabbit@ubuntu-trusty-64
Connection: 127.0.0.1:35834 -> 127.0.0.1:5672
Virtual host: /
User: guest
Channel: 1
Exchange: sneakers
Routing keys: [<<"mailers">>]
Routed queues: []
Properties: [{<<"priority">>,signedint,0},
{<<"delivery_mode">>,signedint,2},
{<<"content_type">>,longstr,<<"application/octet-stream">>}]
Payload:
{"job_class":"ActionMailer::DeliveryJob","job_id":"7a58ab27-d110-4e8b-911b-fe821735e1b7","queue_name":"mailers","arguments":["ApplicationMailer","send_newsletter","deliver_now",...
What is the correct WORKER name for 'deliver_later' Active Job and Sneakers? Thank you.