[rabbitmq-discuss] How to not publish messages, if queue is full?

sergey at openbridge.com sergey at openbridge.com
Mon Jul 15 15:14:40 BST 2013


Hi everybody,

I tried to put a limit on the queue size using 'x-max-length', but the 
problem is Messages will be dropped or dead-lettered from the front of the 
queue to make room for new messages once the limit is reached.
 
What are the possible ways to not drop the messages? Ideally I would like 
to throw an Exception if queue is full. 

First I was thinking to check the queue size, and if it's full than stop. 
But for example if I have 5 producers and queue limit size is set to 10, 
and I already have 9 messages in the queue, than all 5 producers will check 
the size, and publish their messages and 4 messages will be lost.

That's how I declare x-max-length':

result = channel.queue_declare(queue='Test', arguments={ 'x-max-length' : 
10})
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130715/b9be6476/attachment.htm>


More information about the rabbitmq-discuss mailing list