Updated: Jun 21
This article talks about Amazon SQS, its features and its types in a summarized way.
What is Amazon SQS?
Amazon Simple Queue Service (SQS) is a fully managed queue service by Amazon web services. It simply stores and sends messages between software components. SQS enables to decouple micro-services, distributed and server-less applications. It is a scale-able and cost-effective service. There is no upfront cost and one can pay as per usage.
The below illustration shows that a queue having multiple messages being sent from one application component to other.
What are the features of Amazon SQS?
Following are the typical features of Amazon SQS service.
Unlimited messages and queues allowed
Message size accepted upto 256 KB
Batch messages upto 10 messages or 256 KB size in total accepted
Messages retained upto 14 days in the queue
Simultaneous send and read messages
Message locking option available
Queue sharing allowed securely with other AWS accounts
Encryption (SSE) option available with AWS KMS
Dead Letter Queue available for messages not processed successfully
What are the type of queues in Amazon SQS?
There following are the 2 types of queues for delivering messages.
However, there is also another queue for storing messages that are not processed successfully.
Dead Letter Queue
The below illustration shows how a standard queue delivers messages across components.
Messages are delivered at least once
Chances of duplication of messages. This means there may be rare chances that a message may be delivered more than once.
Order of messages not guaranteed
The below illustration shows how a FIFO queue delivers messages across components
Messages are delivered as first in-first out order
Messages are delivered only once
No duplicates delivered
Dead Letter Queue (DLQ)
As mentioned above, this queue is for messages that are not processed successfully. These messages are move to this queue (DLQ) for investigation and analysis. A message can be moved to a standard dead letter queue only when its parent queue is also standard queue and its the same with FIFO queue as well.
Important Terms to know
Message Visibility Timeout
When a message is received in the queue and is being processed by a component, Amazon SQS prevents or hides this message from other consumers processing it by setting a visibility timeout. This means the message will not be visible to other consumers until the visibility timeout duration. This duration can be set from 0 secs to 12 hours per message. The default is set to 30 secs per message.
Message Short Polling
Receive message request queries only a subset of servers to find the messages.
Response is sent immediately even if there is no messages found.
Message Long Polling
Receive message request queries all the servers to find the messages.
Response is sent only after it collects at-least one available message.
If there are no messages in the queue, it waits until the polling wait time expires.
Please provide your valuable feedback on the above topic.