Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # initializer
- Resque::Failure::Multiple.configure do |config|
- config.classes = [Resque::Failure::Redis, Resque::Failure::Notifier]
- end
- #lib/resque/failure/notifier.rb
- #===============================
- module Resque
- module Failure
- # Store a copy of the failure in Redis, so we have access from the UI. Also
- # send an email to the developer, so we know something went foul.
- class Notifier < Base
- def save
- # Create notification email
- email = TMail::Mail.new
- email.to = my_email_address
- email.subject = "[Resque] #{exception}"
- email.body = <<-EOF
- Queue: #{queue}
- Worker: #{worker}
- #{payload.inspect}
- #{exception}
- #{exception.backtrace.join("\n")}
- EOF
- Mailer.deliver email
- rescue
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment