class Rabbitek::Server::Hooks::Retry

Hook to retry failed jobs

Public Instance Methods

call(consumer, message) click to toggle source
Calls superclass method Rabbitek::ServerHook#call
# File lib/rabbitek/server/hooks/retry.rb, line 13
def call(consumer, message)
  super
rescue StandardError
  retry_message(consumer, message) unless consumer.opts[:batch]
  raise
end

Private Instance Methods

retry_message(consumer, message) click to toggle source
# File lib/rabbitek/server/hooks/retry.rb, line 22
def retry_message(consumer, message)
  Retryer.call(consumer, message)
rescue StandardError => e
  error(
    message: 'Critical error while retrying. Nacking and requeueing message',
    consumer: message.delivery_info.routing_key,
    jid: consumer.jid,
    error: e.to_s
  )

  consumer.nack!(message.delivery_info)
end