Queue / Action / delete_messages
delete_messages#
- SQS.Queue.delete_messages(**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.Some actions take lists of parameters. These lists are specified using the
param.nnotation. Values ofnare integers starting from 1. For example, a parameter list with two elements looks like this:&AttributeName.1=first&AttributeName.2=secondSee also: AWS API Documentation
Request Syntax
response = queue.delete_messages( Entries=[ { 'Id': 'string', 'ReceiptHandle': 'string' }, ] )
- Parameters:
Entries (list) –
[REQUIRED]
A list of receipt handles for the messages to be deleted.
(dict) –
Encloses a receipt handle and an identifier for it.
Id (string) – [REQUIRED]
An 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.