AWS Certified Solutions Architect – Associate (SAA-C02) — Question 273
A company wants to build an online marketplace application on AWS as a set of loosely coupled microservices. For this application, when a customer submits a new order, two microservices should handle the event simultaneously. The Email microservice will send a confirmation email, and the OrderProcessing microservice will start the order delivery process. If a customer cancels an order, the OrderCancellation and Email microservices should handle the event simultaneously.
A solutions architect wants to use Amazon Simple Queue Service (Amazon SQS) and Amazon Simple Notification Service (Amazon SNS) to design the messaging between the microservices.
How should the solutions architect design the solution?
Answer options
- A. Create a single SQS queue and publish order events to it. The Email, OrderProcessing, and OrderCancellation microservices can then consume messages off the queue.
- B. Create three SNS topics for each microservice. Publish order events to the three topics. Subscribe each of the Email, OrderProcessing, and OrderCancellation microservices to its own topic.
- C. Create an SNS topic and publish order events to it. Create three SQS queues for the Email, OrderProcessing, and OrderCancellation microservices. Subscribe all SQS queues to the SNS topic with message filtering.
- D. Create two SQS queues and publish order events to both queues simultaneously. One queue is for the Email and OrderProcessing microservices. The second queue is for the Email and OrderCancellation microservices.
Correct answer: C
Explanation
Using the fan-out pattern with an Amazon SNS topic subscribed to multiple Amazon SQS queues ensures that messages are delivered reliably and simultaneously to different microservices. By applying SNS message filtering, each queue (Email, OrderProcessing, and OrderCancellation) only receives the specific event types (such as order creation or cancellation) it needs to process. Other options fail because they either cause message competition on a single queue or lack the decoupling and filtering capabilities provided by the SNS-to-SQS fan-out design.