2023/06/06 - Amazon Simple Queue Service - 3 new api methods
Changes Amazon SQS adds three new APIs - StartMessageMoveTask, CancelMessageMoveTask, and ListMessageMoveTasks to automate redriving messages from dead-letter queues to source queues or a custom destination.
Cancels a specified message movement task.
Note
A message movement can only be cancelled when the current status is RUNNING.
Cancelling a message movement task does not revert the messages that have already been moved. It can only stop the messages that have not been moved yet.
See also: AWS API Documentation
Request Syntax
client.cancel_message_move_task( TaskHandle='string' )
string
[REQUIRED]
An identifier associated with a message movement task.
dict
Response Syntax
{ 'ApproximateNumberOfMessagesMoved': 123 }
Response Structure
(dict) --
ApproximateNumberOfMessagesMoved (integer) --
The approximate number of messages already moved to the destination queue.
Gets the most recent message movement tasks (up to 10) under a specific source queue.
See also: AWS API Documentation
Request Syntax
client.list_message_move_tasks( SourceArn='string', MaxResults=123 )
string
[REQUIRED]
The ARN of the queue whose message movement tasks are to be listed.
integer
The maximum number of results to include in the response. The default is 1, which provides the most recent message movement task. The upper limit is 10.
dict
Response Syntax
{ 'Results': [ { 'TaskHandle': 'string', 'Status': 'string', 'SourceArn': 'string', 'DestinationArn': 'string', 'MaxNumberOfMessagesPerSecond': 123, 'ApproximateNumberOfMessagesMoved': 123, 'ApproximateNumberOfMessagesToMove': 123, 'FailureReason': 'string', 'StartedTimestamp': 123 }, ] }
Response Structure
(dict) --
Results (list) --
A list of message movement tasks and their attributes.
(dict) --
Contains the details of a message movement task.
TaskHandle (string) --
An identifier associated with a message movement task. When this field is returned in the response of the ListMessageMoveTasks action, it is only populated for tasks that are in RUNNING status.
Status (string) --
The status of the message movement task. Possible values are: RUNNING, COMPLETED, CANCELLING, CANCELLED, and FAILED.
SourceArn (string) --
The ARN of the queue that contains the messages to be moved to another queue.
DestinationArn (string) --
The ARN of the destination queue if it has been specified in the StartMessageMoveTask request. If a DestinationArn has not been specified in the StartMessageMoveTask request, this field value will be NULL.
MaxNumberOfMessagesPerSecond (integer) --
The number of messages to be moved per second (the message movement rate), if it has been specified in the StartMessageMoveTask request. If a MaxNumberOfMessagesPerSecond has not been specified in the StartMessageMoveTask request, this field value will be NULL.
ApproximateNumberOfMessagesMoved (integer) --
The approximate number of messages already moved to the destination queue.
ApproximateNumberOfMessagesToMove (integer) --
The number of messages to be moved from the source queue. This number is obtained at the time of starting the message movement task.
FailureReason (string) --
The task failure reason (only included if the task status is FAILED).
StartedTimestamp (integer) --
The timestamp of starting the message movement task.
Starts an asynchronous task to move messages from a specified source queue to a specified destination queue.
Note
This action is currently limited to supporting message redrive from dead-letter queues (DLQs) only. In this context, the source queue is the dead-letter queue (DLQ), while the destination queue can be the original source queue (from which the messages were driven to the dead-letter-queue), or a custom destination queue.
Currently, only standard queues are supported.
Only one active message movement task is supported per queue at any given time.
See also: AWS API Documentation
Request Syntax
client.start_message_move_task( SourceArn='string', DestinationArn='string', MaxNumberOfMessagesPerSecond=123 )
string
[REQUIRED]
The ARN of the queue that contains the messages to be moved to another queue. Currently, only dead-letter queue (DLQ) ARNs are accepted.
string
The ARN of the queue that receives the moved messages. You can use this field to specify the destination queue where you would like to redrive messages. If this field is left blank, the messages will be redriven back to their respective original source queues.
integer
The number of messages to be moved per second (the message movement rate). You can use this field to define a fixed message movement rate. The maximum value for messages per second is 500. If this field is left blank, the system will optimize the rate based on the queue message backlog size, which may vary throughout the duration of the message movement task.
dict
Response Syntax
{ 'TaskHandle': 'string' }
Response Structure
(dict) --
TaskHandle (string) --
An identifier associated with a message movement task. You can use this identifier to cancel a specified message movement task using the CancelMessageMoveTask action.