Closed posix4e closed 3 years ago
Do you mean you raise an exception in order to prevent the message from being deleted, thereby allowing it to slip back into the queue after the timeout is reached?
I thought when we crash, the message comes back after the visability timeout. That's fine, i just don't wanna trigger an error
The listener runs everything in a try - except
clause, if that's your concern. The message will come back after the timeout if there's an uncaught exception in handle_message
method. If you want the message to always get deleted, you can catch all the exceptions yourself or just use the force_delete
kwarg
What if I want to re-enqueue after timeout with something less noisy then a bare raise
Then you don't need to do anything. SQS requeues the message after the timeout automatically (unless it's reached its max_retries
as defined on the queue).
I feel like either I'm not understanding your question properly, or there's something fundamental that one of us is not getting about the way SQS works. Please elaborate and explain why my previous answers weren't sufficient
Ahh so just don't return? Wait for forever? My goal is to have it re-enqueued but not to raise? I should just pause? Wont that tie things up?
Ok, now I understand the issue. Yes, I think raising an exception is the way to go here. If you want it to be requeued immediately, you should try setting the message timeout to 0 as stated above
ooh great! that’s easy let us add an example in the docs
I know this thread is kind of stale, but it would be awesome if you could submit a PR with the example we discussed.
Currently in much of our code we rely on the raise to trigger the redelivery functionality. I'm curious if there's a more explicit path I can to re-enqueue the msg easily without a loud raise.