sqs-dg-2009-02-01
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Amazon Simple Queue Service Developer Guide
Resources Required to Process Messages
Message IDs
In versions of Amazon SQS prior to 2009-02-01, each message received a system-assigned identifier
that you needed in order to delete the message from the queue. SQS still returns this message ID to you
in the SendMessage response, but you can no longer use the message ID to delete the message. Instead
you need a receipt handle.
Receipt Handles
Each time you receive a message from a queue, you receive a receipt handle for that message. The
handle is associated with the act of receiving the message, not with the message itself. To delete the
message or to change the message visibility, you must provide the receipt handle and not the message
ID. This means you must always receive a message before you can delete it (you can't put a message
into the queue and then recall it).
Important
If you receive a message more than once, each time you receive it, you get a different receipt
handle. You must provide the most recently received receipt handle when you request to delete
the message or the message might not be deleted.
Following is an example of a receipt handle.
MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljTM8tJJg6HRG6PYSasuWXPJB+Cw
Lj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQ+QE
auMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0=
Resources Required to Process Messages
To help you estimate the amount of resources needed to process your queued messages, Amazon SQS
can provide you with an approximate number of messages in a queue. You can view the number of
messages that are visible or you can view the number of messages that are not visible. Messages that
are not visible are messages in a queue that are not timed-out and not deleted. For more information
about visibility, see Visibility Timeout (p. 8).
Important
Because of the distributed architecture of SQS, the result is not an exact count of the number of
messages in a queue. In most cases it should be close to the actual number of messages in the
queue, but you should not rely on the count being precise.
The following table lists the API action to use.
To do this...
Get the approximate number of messages in the queue
Get the approximate number of messages in the queue that
are not visible
Use this action
GetQueueAttributes
GetQueueAttributes
API Version 2009-02-01
7