Overview
Send email with predefined template when resque worker die of any reason.
Folk from https://github.com/anandagrawal84/resque_failed_job_mailer and customizable.
Making it general and seperate from anandagrawal84/resque_failed_job_mailer due to inactive repo.
Installation
gem install resque-failed-job-mailer-2
Or add to Gemfile:
gem 'resque-failed-job-mailer-2'
Usage
All you need to do is configure ActionMailer for smtp details. Add following configuration file resque_failed_job_mailer.rb
in config/initializer
folder
Resque::Failure::Notifier.configure do |config|
config.from = 'dummy@dummy.com'
config.to = 'dummy@dummy.com'
config.include_payload = true
config.include_exception = true
config.tags = ["ProjectX","Wolverine","Resque"]
end
as soon as resque job fail it would send out an email to the configured email address.
Configuration
If you want to use your own email mechanism then add following configuration
Resque::Failure::Notifier.configure do |config|
config.mailer = ActionMailerClass
config.mail = ActionMailerMailMethod
config.from = 'dummy@dummy.com'
config.to = 'dummy@dummy.com'
end
config.mailer
is any class that extends ActionMailer::Base
config.mail
is mail in class given above in config.mailer