Module: Sidekiq::Sqs::AwsSdk::BatchSendFailurePatch

Extended by:
ActiveSupport::Concern
Defined in:
lib/sidekiq-sqs/aws-sdk/batch_send_failure_patch.rb

Instance Method Summary collapse

Instance Method Details

#batch_failures(entries, response) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sidekiq-sqs/aws-sdk/batch_send_failure_patch.rb', line 11

def batch_failures entries, response
  response[:failed].inject([]) do |failures, failure|

    entry = entries.find{|e| e[:id] == failure[:id] }

    details = {
      :error_code => failure[:code],
      :error_message => failure[:message],
      :sender_fault => failure[:sender_fault],
      :message => entry[:message_body] # We need this for retrying
    }

    if handle = entry[:receipt_handle]
      details[:receipt_handle] = handle
    end

    failures << details
  end
end