A company’s ecommerce checkout workflow writes an order to a database and calls a payment service. Users experience timeouts during checkout; when they resubmit, multiple unique orders are created for the same transaction. How should a solutions architect refactor the workflow to prevent multiple orders?
Choose an answer
Tap an option to check your answer.
Correct answer: Store the order in the database. Send a message that includes the order number to an Amazon Simple Queue Service (Amazon SQS) FIFO queue. Have the payment service retrieve the message, process the order, and then delete the message from the queue..
Why this is the answer
Storing the order in the database first ensures data persistence. Sending the order number to an Amazon SQS FIFO (First-In, First-Out) queue guarantees message ordering and exactly-once processing, which is crucial for preventing duplicate orders. The payment service retrieves the message, processes the order, and then deletes the message, ensuring that even if the client retries, the order is processed only once. Kinesis Data Firehose is for streaming data to destinations, not for reliable, ordered message processing between services. CloudTrail is for logging API activity, not for orchestrating application workflows. Amazon SNS is a publish/subscribe service that delivers messages to multiple subscribers, but it doesn't guarantee exactly-once delivery or message ordering for individual subscribers in the same way SQS FIFO does, making it unsuitable for preventing duplicate orders in this scenario.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed