DEV Community

Cover image for Learning AWS Day by Day — Day 56 — Amazon SQS — FIFO queues
Saloni Singh
Saloni Singh

Posted on

Learning AWS Day by Day — Day 56 — Amazon SQS — FIFO queues

Exploring AWS !!

Day 56

Amazon SQS — FIFO queues

FIFO (First In First Out) — all capabilities of standard queue, used when order is important and duplicity of messages can’t be tolerated.

Examples of usage:
Ecommerce websites for order management where order is critical.
Third-party systems integration where events to be delivered are necessary to be delivered only once.
Communications and networking — sending and receiving data in same order.
Online ticketing service — where tickets are given according to first come first serve basis.

FIFO queues are available in all regions.

FIFO delivery logic -
Sending messages:
If sending multiple messages, a deduplication ID is provided, SQS stores the messages and acknowledges the transmission. Then, each message can be received and processed in the order they were sent, so that order is maintained.
Here, messages are ordered according to their unique message group ID. You need to associate these IDs with the message when processing, else the action may fail. If you decide to process the group of messages, then you can provide same ID to all the messages.
Receiving messages:
Specific message group ID requests cannot be processed. When messages are processed with same message group ID, FIFO tries to send all the messages with same group ID first. This lets other users to process messages with a different message group ID. Once you receive a message from a message group ID, you cannot receive another message unless you delete the present one.
Retrying Multiple Times:
Allows producers or consumers to attempt multiple retries. If a producer detects failed SendMessage, it can retry to resend the message, using same deduplication ID. If a consumer detects failed ReceiveMessage, it can retry many times, using same receive request message ID. When you receive a message with a group ID, you cannot receive the messages from same ID further unless you delete it.

Image description

Message Ordering
Most important features are First-In-First-Out, and exactly-once-processing. The message delivery is strictly ordered and no duplicates are delivered.

Higher Throughput
Supports high number of requests per API, per second. To increase number of requests you can increase number of message groups.

Compatibility
Following services are not compatible with FIFO:
S3 Event Notifications
Lambda Dead Letter queues
Autoscaling Lifecycle Hooks
IoT Rule Actions

Top comments (0)