[rabbitmq-discuss] Bound Queues
matthias at rabbitmq.com
Tue May 18 20:20:40 BST 2010
Vick Khera wrote:
> On Tue, May 18, 2010 at 7:09 AM, Matthias Radestock
> <matthias at rabbitmq.com> wrote:
>> Vick Khera wrote:
>>> What if my producers used the "mandatory" flag to detect if the queue
>>> is full, and then just pause for a while if it is?
>> I think you mean the "immediate" flag. Yes, that would sort of work but if
>> all producers do the same, all the time, then rabbit would never queue any
>> messages at all. I'm guessing that is probably not what you want.
> I would hope that my consumer would eventually clear up the queue
> enough that the producers can start up again.
That wasn't my point. If all producers publish messages with the
immediate flag set all the time then rabbit will return - rather than
enqueue - the published messages if they cannot be delivered to a
consumer straight away. Nothing would get queued, ever.
...except rabbit has to hold on to delivered but unacknowledged
messages, which actually uncovers another issue with this scheme: there
is no bound to the volume of messages that may have been sent out to
consumers but remain unacknowledged. You could set a prefetch window
with basic.qos though, or use auto-ack.
Anyway, if you are concerned about overloading the broker, then handling
channel.flow is by far the best available option.
More information about the rabbitmq-discuss