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