Q89 — AWS DVA-C02 Ch.3
Question 89 of 100 | ← Chapter 3
A developer is designing a serverless application that allows customers to select seats for concerts. Customers submit ticket requests via an AWS Lambda function integrated with an Amazon API Gateway API, which generates an order ID. The application includes two additional Lambda functions: one for inventory management and one for payment processing. These two Lambda functions run asynchronously and write orders to an Amazon DynamoDB table. The application must fulfill the following requirement: If a seat is accidentally sold more than once, the application must reject the second order. In such cases, only the second order’s payment must be processed. However, if the second order’s payment is rejected during processing, the third order must claim the seat—and its payment must be processed. Which solution meets these requirements?
- A. Send the order ID to an Amazon Simple Notification Service (Amazon SNS) FIFO topic, which fans out to one Amazon Simple Queue Service (Amazon SQS) FIFO queue for inventory management and another SQS FIFO queue for payment processing. ✓
- B. Modify the Lambda function that generates the order ID to invoke the inventory management Lambda function, then invoke the payment processing Lambda function.
- C. Send the order ID to an Amazon Simple Notification Service (Amazon SNS) topic and subscribe Lambda functions for inventory management and payment processing to the topic.
- D. Send the order ID to an Amazon Simple Queue Service (Amazon SQS) queue and configure Lambda functions for inventory management and payment processing to poll the queue.
Correct Answer: A. Send the order ID to an Amazon Simple Notification Service (Amazon SNS) FIFO topic, which fans out to one Amazon Simple Queue Service (Amazon SQS) FIFO queue for inventory management and another SQS FIFO queue for payment processing.
Explanation
Option A satisfies the requirements. Sending the order ID to an Amazon SNS FIFO topic ensures strict message ordering. Fan-out to two separate SQS FIFO queues—one for inventory management and one for payment processing—enables ordered, parallel processing per order. If the first order’s payment is rejected, the second order can promptly claim the seat and proceed with payment processing, meeting the seat allocation and payment logic. Option B cannot guarantee parallelism or strict ordering across independent workflows. Option C uses a standard SNS topic, which does not guarantee message ordering. Option D uses a standard SQS queue, which also lacks strict ordering guarantees required for deterministic seat assignment and cascading fallback logic. Therefore, Option A is correct.