A Lambda function processes SQS messages in batches of 10 through an event source mapping. When one message fails, the whole batch returns to the queue and messages that already succeeded are processed again. Which changes make Lambda retry only the failed messages? (Choose two.)
Choose 2 answers
Show the answer
Correct answersA. Enable ReportBatchItemFailures in the event source mapping's function response types.C. Return the failed messages' IDs in batchItemFailures from the handler.
AWhy this is right: ReportBatchItemFailures tells Lambda to read a partial batch response from the function.
BWhy not this: SQS event source mappings do not support on-failure destinations; failed messages go to the queue's dead-letter queue.
CWhy this is right: Listing the failed message IDs in batchItemFailures lets Lambda delete the rest and retry only those.
DWhy not this: A longer visibility timeout prevents premature redelivery but still retries the whole batch.
EWhy not this: The batch window controls how long Lambda gathers records, not which records are retried.
With ReportBatchItemFailures enabled, the handler returns a batchItemFailures list of the failed message IDs, and Lambda deletes the successful messages while only the listed ones become visible again for retry. SQS event source mappings use the queue's dead-letter queue rather than on-failure destinations, and visibility timeout and batch window settings do not create partial batch responses.