Created
September 20, 2010 17:23
-
-
Save mmarschall/588256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment