Sets the VisibilityTimeout, which controls how long a message is hidden from a ReceiveMessage request. Once a message is returned to an initial ReceiveMessage request, it will not be returned on subsequent ReceiveMessage requests for the duration of the VisibilityTimeout period. Once that duration has passed, the message will again be returned to a ReceiveMessage request unless it is deleted from the queue.
Messages that are meant to be received only once should be deleted using DeleteMessage within the duration of the VisibilityTimeout.
The VisibilityTimeout value is set for all messages in the queue. It cannot be set for a specific message.

For example, message A is in a queue and has a visibility timeout set at 30 seconds. A ReceiveMessage request is made on that queue, and message A is returned. A subsequent ReceiveMessage request is made in 10 seconds (within the span of the VisibilityTimeout of 30 seconds), and so message A is not returned to that request. Another request is made 20 seconds after the first request. Message A is again not returned. After the visibility timeout expires (after 30 seconds), and until message A is deleted from the queue, message A will be available to be returned by any ReceiveMessage request.
The following criteria are validated in a SetVisibilityTimeout request.
VisibilityTimeout must be an integer between 0 and 86400.
The specified resource must exist (the URL to the resource must have been returned by an SQS request).
| Name | Description | Type | Value |
|---|---|---|---|
VisibilityTimeout
| Required. The duration, in seconds, that messages are hidden from subsequent read requests after they've been retrieved by a ReceiveMessage request. | Integer | 0 to 86400 seconds (maximum 24 hours) |
The following example sets the visibility timeout to 35 seconds for all messages in the specified queue.
<soap:Body wsu:Id="body"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<m:SetVisibilityTimeout xmlns:m="http://queue.amazonaws.com/doc/2006-01-01/">
<m:VisibilityTimeout>
35
</m:VisibilityTimeout>
</m:SetVisibilityTimeout>
</soap:Body>