A serverless ticketing system generates an order ID and then runs inventory and payment Lambda functions in parallel. If a seat is accidentally sold twice, the first order received must get the seat and only that order’s payment should be processed. If the first order’s payment is rejected, the second order should get the seat and its payment should be processed. Which design meets these requirements?
Choose an answer
Tap an option to check your answer.
Correct answer: Send the order ID to an Amazon SNS FIFO topic that fans out to one Amazon SQS FIFO queue for inventory management and another SQS FIFO queue for payment processing..
Why this is the answer
The correct design uses Amazon SNS FIFO and SQS FIFO to ensure strict ordering and exactly-once processing, which is crucial for preventing double-selling and correctly handling payment retries. SNS FIFO maintains the order of messages and delivers them to subscribed SQS FIFO queues in the same order. SQS FIFO guarantees that messages are processed in the exact order they are sent and that a message is delivered exactly once, preventing race conditions where two orders might try to claim the same seat simultaneously. If the first payment fails, the second order can then be processed in its turn. The other options are incorrect because they do not guarantee the strict ordering and exactly-once processing required. Changing the Lambda invocation order makes the process sequential, which is not parallel. Using standard SNS topics or SQS queues does not guarantee message order or exactly-once delivery, which could lead to race conditions and incorrect seat assignments or payment processing.
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