Skip to main content

Simple Queue Service Change Message Visibility

Changes the visibility timeout of a specified message in a queue to a new value.

The default visibility timeout for a message is 30 seconds. The minimum is 0 seconds. The maximum is 12 hours.

For more information, see the Amazon AWS Developer Guide.

For example, you have a message with a visibility timeout of 5 minutes. After 3 minutes, you call the Change SQS Message Visibility action with a timeout of 10 minutes. You can continue to call the Change SQS Message Visibility action to extend the visibility timeout to the maximum allowed time. If you try to extend the visibility timeout beyond the maximum, your request is rejected.

An Amazon SQS message has three basic states:

  • Sent to a queue by a producer.
  • Received from the queue by a consumer.
  • Deleted from the queue.

A message is considered to be stored after it is sent to a queue by a producer, but not yet received from the queue by a consumer (that is, between states 1 and 2). There is no limit to the number of stored messages.

A message is considered to be in flight after it is received from a queue by a consumer, but not yet deleted from the queue (that is, between states 2 and 3). There is a limit to the number of inflight messages.

Limits that apply to inflight messages are unrelated to the unlimited number of stored messages.

For most standard queues (depending on queue traffic and message backlog), there can be a maximum of approximately 120,000 inflight messages (received from a queue by a consumer, but not yet deleted from the queue). If you reach this limit, Amazon SQS returns the OverLimit error message. To avoid reaching the limit, you should delete messages from the queue after they''re processed. You can also increase the number of queues you use to process your messages. To request a limit increase, file a support request.

For FIFO queues, there can be a maximum of 20,000 inflight messages (received from a queue by a consumer, but not yet deleted from the queue). If you reach this limit, Amazon SQS returns no error messages.

note

If you attempt to set the VisibilityTimeout to a value greater than the maximum time left, Amazon SQS returns an error. Amazon SQS doesn't automatically recalculate and increase the timeout to the maximum remaining time.

Unlike with a queue, when you change the visibility timeout for a specific message the timeout value is applied immediately but isn't saved in memory for that message. If you don''t delete a message after it is received, the visibility timeout for the message reverts to the original timeout value (not to the value you set using the Change SQS Message Visibility action) the next time the message is received.

External Documentation

To learn more, visit the AWS documentation.

Basic Parameters

ParameterDescription
AWS RegionEnter the desired AWS Region(s).To execute the action in multiple regions, provide a comma-separated list.For example: us-east-1,eu-west-2.If you wish to run the action in all available regions, use the asterisk symbol (*) instead.
Account NumberAccount number of the account that owns the queue.
Queue NameName of the queue to access.
Receipt HandleThe receipt handle associated with the message to extend the visibility of.
Visibility TimeoutThe new value for the message's visibility timeout (in seconds).Values range: 0 to 43200. Maximum: 12 hours.

Advanced Parameters

ParameterDescription
Disable XML To JSON Auto ConvertWhen checked, XML responses are not automatically converted into JSON format.

Example Output

{
"ChangeMessageVisibilityResponse": {
"-xmlns": "http://queue.amazonaws.com/doc/2012-11-05/",
"ResponseMetadata": {
"RequestId": "2b7d65b7-5445-5636-94e0-39ff23084e08"
}
}
}

Workflow Library Example

Simple Queue Service Change Message Visibility with Aws and Send Results Via Email

Workflow LibraryPreview this Workflow on desktop