Date :- Sept 05, 2023 Day :- Tuesday
Lambda provides the ability to handle failed SQS messages in batches by implementing partial batch responses. Let's check out..
Image via Unsplash
1
You enable Report-Batch-Item-Failures for your Lambda function’s event source mapping.
Image via Unsplash
2
Image via Unsplash
When Lambda invokes your function with an SQS batch, your code processes each message. If any messages fail, you capture their IDs.
3
Image via Unsplash
Your function response includes a batch-Item-Failures array containing the IDs of failed messages.
4
Image via Unsplash
Lambda will make only the failed messages visible again in the SQS queue. Successfully processed messages are removed.
5
Image via Unsplash
If your function throws an exception, the entire batch is considered failed and all messages become visible again.