Hey there, welcome back! In our introductory discussion, we briefly touched on AWS' Simple Queue Service (SQS) — a fully-managed messaging service perfect for decoupling and scaling microservices, distributed systems, and serverless applications. While we haven't delved into specifics yet, it's important to note that SQS offers two primary types of queues: Standard Queues and FIFO (First-In-First-Out) Queues. Let's explore these in more detail now:
- Standard Queues ensure maximum throughput and at-least-once delivery, but messages might be delivered out of order.
- FIFO Queues, on the other hand, deliver messages exactly once and preserve the order of messages — ensuring a message is processed only after the previous one.
Let's delve into some more technical aspects. An SQS queue has a set of characteristics, known as attributes, that control the queue's behavior. Here are some important ones you should be aware of:
-
VisibilityTimeout
: This attribute indicates how long a message remains "invisible" to other consumers after it is read from the queue. This prevents multiple consumers from processing the same message. If the processing isn't acknowledged through message deletion within this period, the message reappears in the queue for processing by another consumer. By default, this is 30 seconds. -
DelaySeconds
: This attribute holds the delay duration between a message being sent and it becoming available for processing. This can help in scenarios where processing should not occur immediately after message dispatch. The range is 0 to 900 seconds (15 minutes), with the default being 0 for immediate availability. -
MessageRetentionPeriod
: This attribute specifies the maximum duration a message exists in the queue without being deleted. If a message isn't processed and deleted within this period, it will be automatically removed from the queue. By default, messages stay in the queue for 345600 seconds (4 days), but they can be retained from 60 seconds to a maximum of 1209600 seconds (14 days).
