This content originally appeared on DEV Community and was authored by MacAndersonUche
Here’s a corrected version of your text:
Imagine a scenario where a Lambda function polls messages from an SQS queue but fails to process some messages.
Issue
During batch processing, SQS doesn't track what happens after triggering Lambda. If a message fails or is throttled, it remains invisible until deleted or made visible again after the VisibilityTimeout expires. Throttled messages are treated as failures, and their ReceiveCount increases each time they're retried. If a large number of messages arrives, some may be throttled and retried repeatedly until they reach the maxReceiveCount and are moved to the Dead Letter Queue (DLQ).
Fix
We implemented two solutions:
- maxReceiveCount: We increased the maxReceiveCount from 1 to 6 in the SQS queue. This was configured using CloudFormation:
Queue:
Type: AWS::SQS::Queue
Properties:
RedrivePolicy:
maxReceiveCount: 6
- VisibilityTimeout: We increased the VisibilityTimeout from 40 to 120 seconds. This was done using CloudFormation:
Queue:
Type: AWS::SQS::Queue
Properties:
VisibilityTimeout: 120
DelaySeconds: 30
This content originally appeared on DEV Community and was authored by MacAndersonUche
MacAndersonUche | Sciencx (2024-09-18T22:30:40+00:00) AWS SQS to Lambda Failed Processed Messages. Retrieved from https://www.scien.cx/2024/09/18/aws-sqs-to-lambda-failed-processed-messages/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.