I am currently developing a rails 4 application. I use devise for authentication. I want to use Sidekiq to send emails. I found this tuto https://github.com/mperham/sidekiq/wiki/Devise but I cannot figure out where I should put the name of the queue. Can anyone help me with a gist. Thank you
2
votes
That page already shows how to configure the queue name, look closer github.com/mperham/sidekiq/wiki/Devise#use-devise-async
– Mike Perham
Thank you Mike, I don't want add devise-async. I followed the "Do it your self" section and I get it running. As I configured many queues I do not know which one is used.
– nizniz
2 Answers
7
votes
Once you have Sidekiq added to your rails app (see link to getting started) In order to use devise with Sidekiq (without devise-async) you can use rails built in ActiveJob. Put this override function in the model that devise is implemented in:
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
configure Sideiq with ActiveJob
# config/application.rb
class Application < Rails::Application
# ...
config.active_job.queue_adapter = :sidekiq
end
And set up your mailers queue for Sidekiq
# config/sidekiq.yml
---
:concurrency: 1
:queues:
- default
- mailers
Also redis should be installed to hold job data for sidekiq, its all given in more detail here