An enterprise transaction processing application uses a decoupled architecture where a core system publishes high-priority financial transaction messages to an Amazon SNS FIFO topic. Two downstream services consume these messages:
- Service A: Runs on AWS Lambda, consumes messages via an Amazon SQS FIFO queue subscribed to the SNS FIFO topic, and updates account balances in an Amazon DynamoDB table. The Lambda function has a maximum concurrency of 5 and can take up to 20 seconds to process a batch of messages.
- Service B: Runs on Amazon ECS Fargate and consumes messages via a separate Amazon SQS FIFO queue subscribed to the SNS FIFO topic for audit logging.
During peak transaction hours, the developer observes two issues:
1. Service A experiences occasional transaction processing failures due to DynamoDB ProvisionedThroughputExceededException. The developer wants to retry only the failed transactions within a batch rather than reprocessing the entire batch, while maintaining the processing order of the remaining messages.
2. Service B occasionally processes duplicate transaction logs. This happens because the publishing system retries sending messages to the SNS FIFO topic when it encounters temporary network timeouts before receiving a publish acknowledgment from SNS.
Which two actions should the developer take to resolve these issues? (Select TWO.)
- Configure the Lambda event source mapping for Service A with ReportBatchItemFailures enabled, and modify the Lambda function code to return the message IDs of the failed transactions in a batchItemFailures array.Cevap
- Configure the publisher application to generate a consistent MessageDeduplicationId based on the unique transaction ID for each SNS FIFO publish request.Cevap
- CConfigure the SQS FIFO queue for Service A with a visibility timeout that is shorter than the Lambda function timeout to ensure that failed messages are retried immediately by another Lambda container.
- DModify the Lambda function for Service A to catch the ProvisionedThroughputExceededException and sleep until the function times out, allowing the SQS visibility timeout to naturally expire and retry the entire batch.
- EReplace the SQS FIFO queue for Service A with a DynamoDB Streams consumer, and query the stream using a Scan operation to find and retry only the failed transactions.