SQS / Client / delete_message_batch
delete_message_batch#
- SQS.Client.delete_message_batch(**kwargs)#
Deletes up to ten messages from the specified queue. This is a batch version of
DeleteMessage.The result of the action on each message is reported individually in the response.Warning
Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of
200.See also: AWS API Documentation
Request Syntax
response = client.delete_message_batch( QueueUrl='string', Entries=[ { 'Id': 'string', 'ReceiptHandle': 'string' }, ] )
- Parameters:
QueueUrl (string) –
[REQUIRED]
The URL of the Amazon SQS queue from which messages are deleted.
Queue URLs and names are case-sensitive.
Entries (list) –
[REQUIRED]
Lists the receipt handles for the messages to be deleted.
(dict) –
Encloses a receipt handle and an identifier for it.
Id (string) – [REQUIRED]
The identifier for this particular receipt handle. This is used to communicate the result.
Note
The ``Id``s of a batch request need to be unique within a request.
This identifier can have up to 80 characters. The following characters are accepted: alphanumeric characters, hyphens(-), and underscores (_).
ReceiptHandle (string) – [REQUIRED]
A receipt handle.
- Return type:
dict
- Returns:
Response Syntax
{ 'Successful': [ { 'Id': 'string' }, ], 'Failed': [ { 'Id': 'string', 'SenderFault': True|False, 'Code': 'string', 'Message': 'string' }, ] }
Response Structure
(dict) –
For each message in the batch, the response contains a
DeleteMessageBatchResultEntrytag if the message is deleted or aBatchResultErrorEntrytag if the message can’t be deleted.Successful (list) –
A list of
DeleteMessageBatchResultEntryitems.(dict) –
Encloses the
Idof an entry inDeleteMessageBatch.Id (string) –
Represents a successfully deleted message.
Failed (list) –
A list of
BatchResultErrorEntryitems.(dict) –
Gives a detailed description of the result of an action on each entry in the request.
Id (string) –
The
Idof an entry in a batch request.SenderFault (boolean) –
Specifies whether the error happened due to the caller of the batch API action.
Code (string) –
An error code representing why the action failed on this entry.
Message (string) –
A message explaining why the action failed on this entry.
Exceptions
SQS.Client.exceptions.TooManyEntriesInBatchRequestSQS.Client.exceptions.EmptyBatchRequestSQS.Client.exceptions.BatchEntryIdsNotDistinctSQS.Client.exceptions.InvalidBatchEntryIdSQS.Client.exceptions.RequestThrottledSQS.Client.exceptions.QueueDoesNotExistSQS.Client.exceptions.UnsupportedOperationSQS.Client.exceptions.InvalidAddressSQS.Client.exceptions.InvalidSecurity