A developer is designing a real-time ticketing system for high-demand concert sales. The booking requests are published to an Amazon SNS FIFO topic, which fans out to an Amazon SQS FIFO queue. An AWS Lambda function processes messages from the SQS FIFO queue in batches of up to messages.
During high-traffic events, some payments fail temporarily due to external payment provider rate limits, causing the Lambda function to return an error. The developer notices that when a single booking message fails in a batch, the entire batch of messages is retried. This leads to redundant processing of successfully authorized bookings in the same batch and blocks messages belonging to other users' sessions from being processed.
Which combination of configuration changes should the developer implement to resolve this issue, ensuring that only failed messages are retried while maintaining strict message ordering for each user?
- Configure the SQS FIFO queue as a Lambda trigger with `ReportBatchItemFailures` enabled in the event source mapping. Modify the Lambda function to catch exceptions during processing, accumulate failed message IDs, and return them in a `batchItemFailures` array. Set the `MessageGroupId` to the user's session ID when publishing to the SNS FIFO topic.Cevap
- BIncrease the Visibility Timeout of the SQS FIFO queue to at least times the Lambda function timeout. Change the Lambda function trigger concurrency limit to to prevent overlapping executions, and configure the SQS FIFO queue to use the user's session ID as the `MessageDeduplicationId`.
- CConfigure the SQS FIFO queue to send failed messages to a standard SQS Dead Letter Queue (DLQ) after a `maxReceiveCount` of . Modify the Lambda function to run with a reserved concurrency of , and ensure the message payload does not exceed the SQS maximum size limit.
- DMigrate the integration to use an Amazon Kinesis Data Stream instead of SQS FIFO. Publish the booking events to the stream using a static string constant as the partition key to guarantee ordering. Configure the Lambda function to process the stream with a custom retry policy.