DVA-C02 Question 30
Single answerYou are developing an e-commerce application on AWS and need to process customer orders. Each order triggers several downstream operations, such as payment processing, inventory updates, and email notifications. You want to ensure the application remains responsive to users placing orders while these downstream tasks are processed. Which approach would best suit this requirement?
- A
Use synchronous API calls to payment processing, inventory updates, and email notifications to ensure all operations complete before responding to the user.
- B
Use an asynchronous workflow by placing the order details into an Amazon SQS queue and processing downstream tasks with worker applications.
- C
Use Amazon SNS to broadcast order details to all downstream systems and wait for each system to confirm completion before responding to the user.
- D
Use AWS Step Functions to orchestrate the entire order process, ensuring all downstream systems complete their tasks before responding to the user.
Show answer and explanation
Correct answer: B
Explanation
Asynchronous patterns, such as using Amazon SQS, allow you to decouple the main application from downstream operations. By placing tasks in a queue, the application can quickly respond to users while background processes handle the tasks. Synchronous patterns, on the other hand, require waiting for all operations to complete, which would reduce responsiveness. Therefore, using Amazon SQS with worker applications is the best approach for this scenario.
- A. Incorrect.
This approach uses synchronous calls, which would make the application wait for all downstream operations to complete before responding to the user. This would negatively impact user responsiveness and is not suitable for this scenario.
- B. Correct.
This approach is correct because it uses an asynchronous pattern by offloading downstream tasks to an Amazon SQS queue. This allows the main application to remain responsive to users while worker applications handle the downstream tasks independently.
- C. Incorrect.
Using Amazon SNS in this way would still require waiting for confirmations from all downstream systems, which means the application would not remain responsive. This approach is not aligned with the requirements of the scenario.
- D. Incorrect.
AWS Step Functions could be used for orchestration, but this approach would likely involve waiting for all tasks to complete before responding to the user, which does not meet the requirement for responsiveness.