Queues
An SQS queue stores each message until a consumer deletes it, and the consumers that poll it compete: each message goes to one of them.
The diagram as text
- Queue orders: 1; 2; 3; 4; 5; Standard: at least once, best-effort order FIFO: in order within a message group
- Producers → Queue orders: SendMessage
- Queue orders → Consumer 1 ReceiveMessage: up to 10, waits up to 20 s: receive
- Queue orders → Consumer 2 ReceiveMessage: up to 10, waits up to 20 s: receive
- Each message goes to one consumer. It stays in the queue until it is deleted or its retention ends: 4 days by default, up to 14
A producer sends one message per SendMessage call. The queue keeps it until a consumer deletes
it or the retention period ends, four days by default and fourteen at most. A message is a text
body of up to 1 MiB and up to ten message attributes.
A consumer asks for messages with ReceiveMessage. One call returns at most ten. With long polling
the call waits up to 20 seconds and answers as soon as a message is there. A received message is
not removed: it stays in the queue, hidden from the other consumers, as Visibility
draws. So the consumers that poll one queue share its messages.
A standard queue delivers every message at least once, sometimes twice, and keeps the order only
on a best-effort basis. A FIFO queue, whose name ends in .fifo, delivers the messages of one
message group in order, as Groups draws.
SQS bills per request, not per message. This crate always asks for ten messages per receive, even for a subscription that handles one message at a time, and hands the batch over one by one.
The model is Amazon SQS's own (basic architecture, long polling, message quotas).