How should messages go to the dead letter queue?
thenano opened this issue · 7 comments
Hi all,
Firstly I'd like to thank you all for this amazing piece of software. The work done with lamby/lambdakiq/lambdapunch is awesome and opens up the world of lambda to rails apps. Thanks so much!
I'm a bit confused as to how the dead letter queue redrive functionality from SQS is supposed to work with lambdakiq. I was a bit surprised to find that when my job fails with some exception, my messages actually don't end up in the dead letter queue at all, after the max retries (set either in the redrive policy or in the configs). After looking at the code I can see that once the max retry number is reached, lambdakiq will log retry_stopped and delete the message from the queue. I later noticed that only when something breaks outside of the lamby/lambdakiq handler will that exception actually cause a failed lambda execution and therefore end with the message in the dead letter queue.
I'm wondering if this is how it was all intended to be, or if I'm missing something?
Thanks very much!
... my messages actually don't end up in the dead letter queue at all, after the max retries ... I can see that once the max retry number is reached, lambdakiq will log retry_stopped and delete the message from the queue ...
I'm pretty sure this is expected behavior. I modeled Lambdakiq after Sidekia & Redis. But after reading the docs again, I do see where we promote the DLQ usage. Damn... maybe you are right and that we should not call delete_message here https://github.com/customink/lambdakiq/blob/main/lib/lambdakiq/job.rb#L75. Would you like to make a PR with that change and see what happens?
Also, thank you for the kind words.
Hi @metaskills thanks for the reply. Sounds good I'll have a shot on a PR and sync back.
@metaskills I've created the pull request: #31
The pull request would also close #26
let me know what you think.
Thanks!
Cool, I'll take a look shortly. First sight, it looks amazing and we can release this soon.
Thank you so much! Released v2.1.0.
Amazing, thank you!