I have 2 Lambda functions that respectively sent and received some workloads via a SQS. But many messages are unexpectedly sent to DLQ. I am confident that it wasn't caused by in-code bugs because not all messages went to DLQ.
I set reservedConcurrentExecutions = 1
and maxReceiveCount = 1
, does it matter? I'm thinking if I increase maxReceiveCount
perhaps fewer messages will be sent to DLQ.
Anyhow, I hope somebody can walk me through the methodology behind that.
Increasing maxReceiveCount
worked eventually. The official developer guide says:
If your function returns an error, or can't be invoked because it's at maximum concurrency, processing might succeed with additional attempts. To give messages a better chance to be processed before sending them to the dead-letter queue, set the maxReceiveCount on the source queue's redrive policy to at least 5.