19.12.2017 Views

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 />

Properties of Distributed Queues<br />

The following table lists the API actions to use.<br />

To do this...<br />

Create a queue<br />

List your queues<br />

Delete a queue<br />

Use this action<br />

CreateQueue<br />

ListQueues<br />

DeleteQueue<br />

Properties of Distributed Queues<br />

The following information can help you design your application to work with Amazon SQS correctly.<br />

Message Order<br />

SQS makes a best effort to preserve order in messages, but due to the distributed nature of the queue,<br />

we cannot guarantee you will receive messages in the exact order you sent them. If your system requires<br />

that order be preserved, we recommend you place sequencing information in each message so you can<br />

reorder the messages upon receipt.<br />

At-Least-Once Delivery<br />

SQS stores copies of your messages on multiple servers for redundancy and high availability. On rare<br />

occasions, one of the servers storing a copy of a message might be unavailable when you receive or<br />

delete the message. If that occurs, the copy of the message will not be deleted on that unavailable server,<br />

and you might get that message copy again when you receive messages. Because of this, you must<br />

design your application to be idempotent (i.e., it must not be adversely affected if it processes the same<br />

message more than once).<br />

Message Sample<br />

When you retrieve messages from the queue, SQS samples a subset of the servers (based on a weighted<br />

random distribution) and returns messages from just those servers. This means that a particular receive<br />

request might not return all your messages. Or, if you have a small number of messages in your queue<br />

(less than 1000), it means a particular request might not return any of your messages, whereas a<br />

subsequent request will. If you keep retrieving from your queues, SQS will sample all of the servers, and<br />

you will receive all of your messages.<br />

The following figure shows messages being returned after one of your system components makes a<br />

receive request. SQS samples several of the servers (in gray) and returns the messages from those<br />

servers (Message A, C, D, and B). Message E is not returned to this particular request, but it would be<br />

returned to a subsequent request.<br />

API Version <strong>2009</strong>-<strong>02</strong>-<strong>01</strong><br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!