Replies: 1 comment 12 replies
-
This was discussed several times and was discussed against. This violates two fairly common assumptions:
If you really want to delete a queue, just delete it without any conditions. Otherwise, a queue with oustanding unacknowledged messages is not really semantically empty. |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
In our product we have jobs subsystem where we create a queue per job. The idea is that queue contains job items and queue consumer handles those job items. As a result of single item handling we could enqueue more job items to the end of the queue. So queue could dynamically grow and shrink. But eventually queue becomes empty when all the items are handled.
The problem is to detect a moment when the queue is empty and it's safe to finalize the job and clean up the queue. We want to do that as quick as possible, so job is marked as done fast. It would be very convenient to use
if-empty
parameter for thequeue delete
action (so if we managed to successfully delete the queue we know that we are done), but unfortunatelyif-empty
does not consider non-acked messages. Apparently it was intentional: see this mail discussion.Describe the solution you'd like
Either would work for my problem:
if-empty
forDelete Queue
, but also consider the non-ACKed messagesDeclare Queue
returns only Ready count, so it's not suitable.Describe alternatives you've considered
For now we are using Management API, but that is non-reliable, slow and extremely inaccurate. Sometimes it shows zero count, while in reality the queue is not empty. Often it out of date. So the only desperate thing we are doing is querying stats from Management API for a few times with a delay. If every time queue is empty - we believe it's empty. But that approach is slow, clumsy and still does not guarantee the correctness. We also delay job completion for ~30 secs which degrades user experience.
Additional context
I would say that the existing
if-empty
behavior for delete queue is not very practical. When you have messages in flight (non-acked yet), it is still possible to that they are NACK-ed (e.g. due to connection issues) and they are returned back to queue. So you actually never want to delete a queue if you have those, as that's a possible to get them lost. That's exactly what happened when I tested them locally and app crashed after deleting the queue but before ACK-ing the messages in flight - messages simply got lost.The main argument for the current behavior given the mail was alignment and consistency across various API. I would though argue that the statement from the mail is true:
Given that they are returned to the queue in case of lost connection makes them still belonging to the queue.
I would suggest to just change the existing behavior of
if-empty
to consider non-ACKed or add a configuration flag for that.Beta Was this translation helpful? Give feedback.
All reactions