What Happens If An SQS Message Processing Fails In Lambda?

ABHAY K SINGH

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

Identifing

You enable Report-Batch-Item-Failures for your Lambda function’s event source mapping.  

Image via Unsplash

2

processing

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

capturing

Image via Unsplash

Your function response includes a batch-Item-Failures array containing the IDs of failed messages.

4

queue processing

Image via Unsplash

Lambda will make only the failed messages visible again in the SQS queue. Successfully processed messages are removed. 

5

Final

Image via Unsplash

If your function throws an exception, the entire batch is considered failed and all messages become visible again.

Read the complete blog in detail :- What Happens If An SQS Message Processing Fails In Lambda? With Example..

Related

BLOGS