1Why Fan-Out?
If an e-commerce order is placed, you need to bill the user, update inventory, and start shipping. Instead of the frontend calling 3 APIs, it sends 1 message to SNS. SNS securely 'fans out' that message to 3 separate SQS queues, guaranteeing delivery to all microservices.
2Step-by-Step Breakdown
What is SNS?. A fully managed pub/sub messaging, SMS, email, and mobile push notifications service.
Topics. A Topic is a logical access point that acts as a communication channel. Publishers send messages to the topic.
Subscriptions. Subscribers listen to a topic. When a message hits the topic, SNS pushes it to all subscribers simultaneously.
The Fan-Out Pattern. A powerful pattern where one SNS topic pushes the exact same message to multiple SQS queues for parallel processing.
Knowledge Check. What architectural pattern involves an SNS topic distributing one message to multiple SQS queues simultaneously?
- →Fan-out Pattern
- →Long Polling Pattern
SNS vs SQS. SNS is PUSH (it sends data to you). SQS is PULL (you must ask for data).
Message Filtering. Subscribers can apply a filter policy so they only receive specific messages from the topic.
Standard vs FIFO Topics. Like SQS, SNS offers Standard (max throughput) and FIFO (strict ordering and deduplication) topics.
Mobile Push & SMS. SNS can send push notifications directly to Apple (APNs), Google (FCM), and raw SMS text messages globally.
Summary. Use SNS to broadcast events across your entire architecture instantly.
