Amazon Simple Queue Service
Developer Guide

Amazon SQS Message Timers

Amazon SQS message timers allow you to specify an initial invisibility period for a message that you add to a queue. For example, if you send a message with the DelaySeconds parameter set to 45, the message isn't visible to consumers for the first 45 seconds during which the message stays in the queue. The default value for DelaySeconds is 0.


FIFO queues don't support timers on individual messages.

An Amazon SQS message has three basic states: 1. Sent to a queue by a producer, 2. Received from the queue by a consumer, and 3. Deleted from the queue. 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 no limit to the number of messages in a queue which are between states 1 and 2.

For standard queues, there can be a maximum of 120,000 inflight messages in a 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 set a delay period that applies to all messages in a queue, use delay queues. A message timer setting for an individual message overrides any DelaySeconds value that applies to the entire delay queue.

Creating Message Timers Using the Console

To send a message with a message timer using the AWS Management Console

  1. Sign in to the Amazon SQS console.

  2. Select a queue.

  3. From the Queue Actions drop-down list, select Send a Message.


    The Queue Actions drop-down list is available only if a queue is selected.

  4. In the Send a Message to MyQueue dialog box, type a message.

  5. In the Delay delivery of this message by text box, enter a delay value (for example, 30) .

  6. Choose Send Message.

  7. In the Send a Message to MyQueue confirmation box, choose Close.

Creating Message Timers Using the Query API

The following Query API example applies a 45-second initial visibility delay for a single message sent with SendMessage.

The structure of AUTHPARAMS depends on the signature of the API request. For more information, see Signing AWS API Requests in the Amazon Web Services General Reference. ?Action=SendMessage &MessageBody=This+is+a+test+message &DelaySeconds=45 &Expires=2015-12-18T22%3A52%3A43PST &Version=2012-11-05 &AUTHPARAMS


Queue names and queue URLs are case-sensitive.

You can also use the Query API SendMessageBatch action to send up to 10 messages with message timers. You can assign a different DelaySeconds value to each message or assign no value at all. If you don't set a value for DelaySeconds, the message might still be subject to a delay if you're adding the message to a delay queue. For more information about delay queues, see Amazon SQS Delay Queues. The following example uses SendMessageBatch to send three messages: one message without a message timer and two messages with different values for DelaySeconds. ?Action=SendMessageBatch &SendMessageBatchRequestEntry.1.Id=test_msg_no_message_timer &SendMessageBatchRequestEntry.1.MessageBody=test%20message%20body%201 &SendMessageBatchRequestEntry.2.Id=test_msg_delay_45_seconds &SendMessageBatchRequestEntry.2.MessageBody=test%20message%20body%202 &SendMessageBatchRequestEntry.2.DelaySeconds=45 &SendMessageBatchRequestEntry.3.Id=test_msg_delay_2_minutes &SendMessageBatchRequestEntry.3.MessageBody=test%20message%20body%203 &SendMessageBatchRequestEntry.3.DelaySeconds=120 &Expires=2015-12-18T22%3A52%3A43PST &Version=2012-11-05 &AUTHPARAMS