Menu
Amazon Simple Queue Service
API Reference (API Version 2012-11-05)

ChangeMessageVisibilityBatch

Changes the visibility timeout of multiple messages. This is a batch version of ChangeMessageVisibility. The result of the action on each message is reported individually in the response. You can send up to 10 ChangeMessageVisibility requests with each ChangeMessageVisibilityBatch action.

Important

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.n notation. Values of n are integers starting from 1. For example, a parameter list with two elements looks like this:

&Attribute.1=this

&Attribute.2=that

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

ChangeMessageVisibilityBatchRequestEntry.N

A list of receipt handles of the messages for which the visibility timeout must be changed.

Type: Array of ChangeMessageVisibilityBatchRequestEntry objects

Required: Yes

QueueUrl

The URL of the Amazon SQS queue whose messages' visibility is changed.

Queue URLs are case-sensitive.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.

BatchResultErrorEntry.N

A list of BatchResultErrorEntry items.

Type: Array of BatchResultErrorEntry objects

ChangeMessageVisibilityBatchResultEntry.N

A list of ChangeMessageVisibilityBatchResultEntry items.

Type: Array of ChangeMessageVisibilityBatchResultEntry objects

Errors

For information about the errors that are common to all actions, see Common Errors.

AWS.SimpleQueueService.BatchEntryIdsNotDistinct

Two or more batch entries in the request have the same Id.

HTTP Status Code: 400

AWS.SimpleQueueService.EmptyBatchRequest

The batch request doesn't contain any entries.

HTTP Status Code: 400

AWS.SimpleQueueService.InvalidBatchEntryId

The Id of a batch entry in a batch request doesn't abide by the specification.

HTTP Status Code: 400

AWS.SimpleQueueService.TooManyEntriesInBatchRequest

The batch request contains more entries than permissible.

HTTP Status Code: 400

Example

ChangeMessageVisibilityBatch request changes the visibility timeout settings for two messages. You must URL-encode the entire URL. However, in this example only the message body is URL-encoded to make the example easier to read.

Sample Request

http://sqs.us-east-2.amazonaws.com/123456789012/testQueue/
&Action=ChangeMessageVisibilityBatch
&Version=2012-11-05
&ChangeMessageVisibilityBatchRequestEntry.1.Id=change_visibility_msg_2
&ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle=gfk0T0R0waama4fVFffkjKzmhMCymjQvfTFk2LxT33G4ms5subrE0deLKWSscPU1oD3J9zgeS4PQQ3U30qOumIE6AdAv3w%2F%2Fa1IXW6AqaWhGsEPaLm3Vf6IiWqdM8u5imB%2BNTwj3tQRzOWdTOePjOjPcTpRxBtXix%2BEvwJOZUma9wabv%2BSw6ZHjwmNcVDx8dZXJhVp16Bksiox%2FGrUvrVTCJRTWTLc59oHLLF8sEkKzRmGNzTDGTiV%2BYjHfQj60FD3rVaXmzTsoNxRhKJ72uIHVMGVQiAGgBX6HGv9LDmYhPXw4hy%2FNgIg%3D%3D
&ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout=45
&ChangeMessageVisibilityBatchRequestEntry.2.Id=change_visibility_msg_3
&ChangeMessageVisibilityBatchRequestEntry.2.ReceiptHandle=gfk0T0R0waama4fVFffkjKzmhMCymjQvfTFk2LxT33FUgBz3%2BnougdeLKWSscPU1%2FXgx%2BxcNnjnQQ3U30qOumIE6AdAv3w%2F%2Fa1IXW6AqaWhGsEPaLm3Vf6IiWqdM8u5imB%2BNTwj3tQRzOWdTOePjOsogjZM%2F7kzn4Ew27XLU9I%2FYaWYmKvDbq%2Fk3HKVB9HfB43kE49atP2aWrzNL4yunG41Q4cfRRtfJdcGQGNHQ2%2Byd0Usf5qR1dZr1iDo5xk946eQat83AxTRP%2BY4Qi0V7FAeSLH9su9xpX6HGv9LDmYhPXw4hy%2FNgIg%3D%3D
&ChangeMessageVisibilityBatchRequestEntry.2.VisibilityTimeout=45
&Expires=2020-10-18T22%3A52%3A43PST

Sample Response

<ChangeMessageVisibilityBatchResponse>
    <ChangeMessageVisibilityBatchResult>
        <ChangeMessageVisibilityBatchResultEntry>
            <Id>change_visibility_msg_2</Id>
        </ChangeMessageVisibilityBatchResultEntry>
        <ChangeMessageVisibilityBatchResultEntry>
            <Id>change_visibility_msg_3</Id>
        </ChangeMessageVisibilityBatchResultEntry>
    </ChangeMessageVisibilityBatchResult>
    <ResponseMetadata>
        <RequestId>ca9668f7-ab1b-4f7a-8859-f15747ab17a7</RequestId>
    </ResponseMetadata>
</ChangeMessageVisibilityBatchResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: