Which solution will meet these requirements?
Send the order ID to an Amazon Simple Notification Service (Amazon SNS) FIFO topic that fans out to one Amazon Simple Queue Service (Amazon SQS) FIFO queue for inventory management and another SQS FIFO queue for payment processing.
Change the Lambda function that generates the order ID to initiate the Lambda function for inventory management. Then initiate the Lambda function for payment processing.
Send the order ID to an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the Lambda functions for inventory management and payment processing to the topic.
Deliver the order ID to an Amazon Simple Queue Service (Amazon SQS) queue. Configure the Lambda functions for inventory management and payment processing to poll the queue.
Explanations:
Using Amazon SNS FIFO topic ensures ordered delivery of order IDs. The associated SQS FIFO queues for inventory management and payment processing can handle messages in a first-in-first-out manner, ensuring that only the first payment is processed and allowing for retry logic in case of payment failure. This setup effectively manages concurrency and guarantees that the first order gets the seat, followed by the second if necessary.
This approach does not ensure the processing order required for managing seat reservations. Initiating both Lambda functions sequentially does not provide a mechanism to handle the scenario where the first order’s payment fails; therefore, it risks losing the proper order of operations.
Using a standard SNS topic does not guarantee the order of message delivery. In the case of concurrent order processing, there’s a risk that the payment processing might not adhere to the first-come, first-served requirement, leading to potential double-selling of seats.
While using SQS can allow for message handling, without FIFO configuration, the order of processing is not guaranteed. If both Lambda functions poll the queue simultaneously, it may lead to a situation where seat assignments are not processed in the necessary order, leading to potential conflicts in seat availability.