I've been trying to configure redeliveries with an ActiveMQ broker using the redelivery plugin. My goal is to have an event redelivered into a Lambda with a configurable delay between attempts, and a maximum redelivery count, moving the message into a Dead Letter Queue after hitting the maximum. This is my plugin config:
<redeliveryPlugin fallbackToDeadLetter="true" sendToDlqIfMaxRetriesExceeded="true">
<redeliveryPolicyMap>
<redeliveryPolicyMap>
<redeliveryPolicyEntries>
<redeliveryPolicy maximumRedeliveries="4" queue="SpecialQueue" redeliveryDelay="10000"/>
</redeliveryPolicyEntries>
<defaultEntry>
<redeliveryPolicy maximumRedeliveries="4" redeliveryDelay="10000"/>
</defaultEntry>
</redeliveryPolicyMap>
</redeliveryPolicyMap>
I've set a queue as the trigger for the lambda, and I'm receiving the messages, but when there's an error, it's causing many more retries than 4. I've also tried configuring the retries when pushing a message into the queue by using the ActiveMQ Web Console, but I'm still getting many more retries than I expect in the lambda. I've removed retries in the lambda asynchronous configuration (not sure if this affects MQ).
My understanding is that I might be conflicting Lambda retries with the queue redelivery, but I can't find anything to indicate that the queue only tried 4 times, and I don't know how to limit the lambda retries other than the Retry attempts
option under Asynchronous Invocation. Any pointers to would be much appreciated.
So if I wanted to do a custom redelivery policy using the plugin, I'd need to consume messages myself from the queue? Do you know if another service like step functions or SNS allows for this? I just want a way to configure lambda execution based on a queue (with redeliveries and DLQ).
I'm also seeing behaviour different than the values in the policy page, I'm seeing retries being executed many more times than 6 times and the delay is much shorter than 1000 ms.
AWS SQS is a queue service. and It can set Maximum receives and and DLQ[1].
And SQS integrated lambda has its retry behavior, you can reference this doc[2].
[1]https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-dead-letter-queue.html
[2]https://docs.aws.amazon.com/zh_cn/lambda/latest/operatorguide/sqs-retries.html
If my answer is useful, adopting it is an encouragement for me,thanks~