You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
When message ordering matters or when messages consistently fail processing, you need more than a Standard queue. FIFO queues guarantee the order of message processing, while dead-letter queues (DLQs) capture messages that cannot be processed after repeated attempts. Together, they form the backbone of robust, fault-tolerant messaging systems.
FIFO stands for First-In, First-Out. Messages are delivered in the exact order they were sent and are processed exactly once.
| Scenario | Why FIFO? |
|---|---|
| Financial transactions | Debits and credits must be applied in order |
| Inventory management | Stock updates must be processed sequentially |
| User action sequences | Login, action, logout must happen in order |
| Command processing | Commands must execute in the sequence issued |
| Workflow steps | Each step depends on the previous one completing |
FIFO queue names must end with the .fifo suffix:
my-order-queue.fifo
payment-processing.fifo
FIFO queues use a Message Group ID to define the scope of ordering. Messages within the same group are strictly ordered. Messages in different groups can be processed in parallel.
sqs.send_message(
QueueUrl='https://sqs.eu-west-2.amazonaws.com/123456789012/orders.fifo',
MessageBody='{"orderId": "ORD-001", "action": "process"}',
MessageGroupId='customer-123',
MessageDeduplicationId='ORD-001-process'
)
Think of Message Group ID like a lane on a motorway. Each lane (group) maintains its own order, but different lanes run in parallel.
Group: customer-123 → [Msg1] [Msg2] [Msg3] → processed in order
Group: customer-456 → [MsgA] [MsgB] [MsgC] → processed in order (parallel with above)
FIFO queues prevent duplicate messages using one of two mechanisms:
1. Content-Based Deduplication
Enable this on the queue, and SQS generates a hash of the message body. If an identical message is sent within the 5-minute deduplication window, it is discarded.
2. Explicit Deduplication ID
Provide a MessageDeduplicationId with each message. SQS uses this ID to detect duplicates within the 5-minute window.
| Method | How It Works | Best For |
|---|---|---|
| Content-based | SHA-256 hash of message body | Messages with unique bodies |
| Explicit ID | You provide a unique deduplication ID | Messages that may have identical bodies but different intent |
| Mode | Throughput |
|---|---|
| Standard FIFO | 300 messages/second per queue |
| High-throughput FIFO | 3,000 messages/second per queue (with batching) |
| With batching | Each batch counts as 1 request, so 10 messages per batch = 3,000 effective messages/second |
To enable high-throughput mode, set the queue attribute DeduplicationScope to messageGroup and FifoThroughputLimit to perMessageGroupId.
A dead-letter queue is a separate SQS queue that receives messages which have failed processing after a specified number of attempts. DLQs prevent "poison messages" from blocking your main queue indefinitely.
maxReceiveCount times without being deleted, SQS automatically moves it to the DLQSubscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.