BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Amazon SNS Supports FIFO for Pub/Sub Messaging

Amazon SNS Supports FIFO for Pub/Sub Messaging

This item in japanese

AWS has recently introduced support for First-in-First-out (FIFO) topics in Amazon SNS with strict ordering and deduplication of messages. The new feature enforces ordering in which messages are sent and received, and avoids that a message is processed multiple times.

Introduced ten years ago, Amazon SNS is a notification service that can send messages to a variety of devices and platforms but until recently it could not support use cases that require fanout of messages to multiple FIFO queues.

Christian Mueller, principal solutions architect at AWS, wrote an article on the benefits of FIFO topics and how to build event driven architectures using them:

Developers increasingly adopt event-driven architectures to decouple their distributed applications. Often, these events must be propagated in a strictly ordered manner to all subscribed applications (...) Before Amazon SNS FIFO, architects had to design applications to check if messages are received out of order before processing (...) and design receivers to be idempotent. In some cases, where the event cannot be idempotent, this requires the receiver to be implemented in an idempotent way.

An implementation is available as an example in GitHub. As a pub/sub messaging service, SNS is often used in combination with Amazon Simple Queue Service (SQS), the distributed message queuing service that since 2016 supports FIFO queues.

Source: https://aws.amazon.com/blogs/aws/introducing-amazon-sns-fifo-first-in-first-out-pub-sub-messaging

Danilo Poccia, chief evangelist EMEA at AWS, describes a few use cases where the new feature can simplify the architecture:

You can use FIFO topics and queues together to simplify the implementation of applications where the order of operations and events is critical, or when you cannot tolerate duplicates, for example, to process financial operations and inventory updates, or to asynchronously apply commands that you receive from a client device. FIFO queues can use message filtering in FIFO topics to selectively receive only a subset of messages rather than every message published to the topic.

The AWS documentation covers as well a different use case, an ecommerce platform built by a manufacturer using Amazon SNS FIFO topics and Amazon SQS FIFO queues.

AWS is not the only cloud provider supporting FIFO in notifications. Azure offers Service Bus, a messaging system for traditional enterprise applications, and Google Cloud Pub/Sub since recently supports ordering, as Michael Gasch, application platform architect at VMware, pointed out:

Nice! Right after Google Cloud Pub/Sub GA-ed FIFO support, AWS adds it to SNS.

Both standard and FIFO Amazon SNS topics support fanning out messages to multiple subscriptions with the same durability but the new FIFO topics have higher prices and limitations compared to standard ones. While standard topics support a nearly unlimited number of messages per second, FIFO topics are limited to 300 transactions per second. Each FIFO topic supports up to 100 subscriptions, while a standard one could handle up to 12.5M subscriptions. Amazon SNS FIFO is available in almost all AWS regions.

Rate this Article

Adoption
Style

BT