SAA-C03 Question 118
Single answerA retail company wants to build an event-driven architecture to process customer orders. When a customer places an order, the system should validate the order, charge the customer, and update the inventory in separate components. Each component should operate independently, and failures in one component should not affect the others. Which solution meets these requirements?
- A
Use an Amazon SQS queue to decouple the components and have each component poll messages from the queue.
- B
Use Amazon SNS to publish an order event and have Lambda functions subscribed to handle validation, charging, and inventory updates.
- C
Use Amazon Kinesis Data Streams to process the events in real-time and ensure order, charging, and inventory updates are handled sequentially.
- D
Use a single Amazon RDS database to store orders, and have each component poll the database for new order records.
Show answer and explanation
Correct answer: B
Explanation
Amazon SNS is the best choice for this scenario because it supports a publish/subscribe model. When a customer places an order, an event can be published to an SNS topic, and multiple subscribers (such as Lambda functions) can process the event independently for validation, charging, and inventory updates. This ensures the components are decoupled, and failures in one component do not affect others. Other options either do not meet the decoupling requirement or are not suitable for event-driven architectures.
- A. Incorrect.
Amazon SQS can decouple components, but it is designed for point-to-point messaging. Each message is processed by only one consumer, making it unsuitable for multiple independent components like validation, charging, and inventory updates.
- B. Correct.
Amazon SNS is a publish/subscribe service that allows multiple subscribers (such as Lambda functions) to independently process the same event. This makes it ideal for an event-driven architecture where each component (validation, charging, inventory updates) operates independently.
- C. Incorrect.
Amazon Kinesis Data Streams is typically used for real-time data streaming and analytics. While it can process events in real-time, it is not specifically designed for decoupling independent components in an event-driven architecture as required in this scenario.
- D. Incorrect.
Using a single RDS database for polling is not event-driven and introduces tight coupling between components. This approach does not meet the requirements of an event-driven architecture.