You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::SQS::Message::Collection

Inherits:
Resources::Collection show all
Defined in:
gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb

Batch Actions collapse

Methods inherited from Resources::Collection

#each, #first, #limit, #size

Instance Method Details

#batch_delete!(options = {}) ⇒ void

This method returns an undefined value.

Parameters:

  • options ({}) (defaults to: {})


213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'gems/aws-sdk-sqs/lib/aws-sdk-sqs/message.rb', line 213

def batch_delete!(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:queue_url] = batch[0].queue_url
    params[:entries] ||= []
    batch.each do |item|
      params[:entries] << {
        id: item.message_id,
        receipt_handle: item.receipt_handle
      }
    end
    batch[0].client.delete_message_batch(params)
  end
  nil
end