-
Notifications
You must be signed in to change notification settings - Fork 290
Retrying a message
phstc edited this page Oct 26, 2014
·
11 revisions
Good news - you don't need to do anything to retry a message, SQS will handle that automatically for you. Basically do not delete sqs_msg.delete if you want to retry a message. The message will become available again when it reaches the visibility_timeout.
class MyWorker
include Shoryuken::Worker
shoryuken_options queue: 'default', delete: true
def perform(sqs_msg, body)
do_something(sqs_msg, body) # raises an exception
end
endThe example above you make the message available again in case the do_something raises an exception. Be careful with the delete option, if it's sent to true it will auto delete the message in case of the worker doesn't raise an exception.