Search code examples
amazon-web-servicesaws-lambdaamazon-sqs

AWS SQS FIFO DLQ: Message has been moved to DLQ before Message retantion expiring


Pretty much the title.

My lambda has failed to process some messages coming from my FIFO SQS queue. The visibility timeout is set to 18 minutes, and Message retention period is set to 4 days.

To my understanding, my consuming lambda will try to process the message every 18 minutes for 4 days. Yet, just some of these failing messages have been moved to the DLQ way earlier than 4 days.

Is there something that I am missing here?

Also, since it is a FIFO queue: assuming there is a series - [1,2,3,4], of messages incoming to my queue having the same GroupID. If message 1 fails, then messages 2,3,4 are not processed. Is this correct? Assuming than that message 1 is moved to DLQ after 4 days, then message 2 will try to get consumed, so on and so forth. Is my understanding correct?

Thanks in advance.


Solution

  • You also need to configure the maxReceiveCount setting on the queue. This determines how many times a single message will be retried before it is moved to the DLQ. I think the default value is 1, so after a single failure a message will be moved to the DLQ.