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

Anton Sizov a.sysoff at gmail.com
Tue Jul 23 10:39:09 BST 2013

Do you really need only 10 messages in queue? What is real number?
Can you describe you problem in details?

Also you can read more about flow control at

On Monday, July 15, 2013 5:14:40 PM UTC+3, ser... at openbridge.com wrote:
> 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/20130723/044e6a2e/attachment.htm>

More information about the rabbitmq-discuss mailing list