A developer is designing a system where order events must be processed independently by both an inventory management service and a shipping notification service. Each service must receive its own copy of every order event. Which of the following configurations should the developer implement? (Select TWO.)
- Publish order events to an Amazon SNS topic.Answer
- Create two separate Amazon SQS queues, subscribe them to the SNS topic, and have each service consume from its own queue.Answer
- CConfigure a single Amazon SQS queue and set the visibility timeout to 0 seconds so that both services can retrieve the same event simultaneously.
- DEmbed AWS access keys directly in the application source code during initialization of the AWS SDK client.
- ESet the processing Lambda function execution timeout to 10 minutes and configure the source SQS queue's visibility timeout to 30 seconds.
Answer
Publish order events to an Amazon SNS topic, and create two separate Amazon SQS queues, subscribe them to the SNS topic, and have each service consume from its own queue.
To decouple services and ensure that both the inventory management and shipping notification services receive every order event, a fan-out pattern must be implemented. This is accomplished by publishing events to an Amazon SNS topic and subscribing two separate Amazon SQS queues (one for each service) to that topic. This setup guarantees that each queue receives a copy of every published event and processes it independently.
Step-by-Step Solution
Key Concept
Message fan-out using Amazon SNS and SQS queues