SQS – Simple Queue Service
Message Size – 256kb
- Type (String/Binary/Number)
- Value – user value
URL : The following is the queue URL for a queue named
MyQueue owned by a user with the AWS account number
- Receipt Handle – each time you recieve a message you get a different receipt handle, this is used to handle when you request to delete a message
- Message Deduplication Id – the token used for deduplication of sent messages, any messages sent with same aren’t delivered during 5 minute deduplication interval
- Message Group Id – group identifier
- Sequence number
- Inflight Message – message received but not yet deleted
- Dead Letter Queue – Queue for others queues to target for messages that can’t be processed, this allow messages to be isolated and help determine why it wasn’t procesed.
Two Types of Queues:
- high throughput
- guaranteed at least once delivery (can be more than once)
- ordered messages
- first in first out delivery
Visibility Timeout (default 30 seconds, Maximum: 12 hours.)
When a consumer receives and processes a message from a queue, it remains in the queue AWS does not automatically delete the message, consumer must request a delete. This is because queue service are in a distributed system there is no guarantee the message has been received already (ie connection broken, component fail etc)
A message once received, to prevent other consumer to reprocess the message, there is a visibility timeout, which a message is not visible to other components. (not a guarantee for standard queues)
Increasing the visibility timeout will decrease cost over time.
You can turn off visibility timeout
How it works:
Works similar like visibility timeout, except message is invisible when first added to queue:
Long polling reduces number of empty responses by allowing SQS to wait until a message is available before sending a response. it returns a message as soon as any messages becomes available.
By default SQS uses short polling, querying only a subset of the servers to determine whether any messages are available. Short Polling occurs when WaitTimeSeconds parameter of a message is set to 0.
Short polling may fail to retrieve messages sometimes, but if no messages can be retrieved after multiple attempts, permissions are the more likely cause.
1 million messages free per month under free tier