<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">(15/07/13 15:14), <a class="moz-txt-link-abbreviated" href="mailto:sergey@openbridge.com">sergey@openbridge.com</a>
wrote:<br>
</div>
<blockquote
cite="mid:025976ec-568b-475c-aa54-234407194476@googlegroups.com"
type="cite">Hi everybody,<br>
<br>
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.<br>
<div> <br>
What are the possible ways to not drop the messages? Ideally I
would like to throw an Exception if queue is full. <br>
<br>
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.<br>
<br>
That's how I declare x-max-length':<br>
<br>
result = channel.queue_declare(queue='Test', arguments={
'x-max-length' : 10})<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
It might be worth trying to drop messages with a probability based
on how full the queue is, like in the <a
href="http://en.wikipedia.org/wiki/Random_early_detection">Random
Early Detection</a> queue management scheme. So, pulling numbers
out of the air, with a max queue length of 100, and if you start
dropping messages when the queue is 50% full, then you might drop
20% of messages when the queue is 60% full, and 80% when 90% full.
The probabilistic aspect means that you're less dependent on timing
of queue length reads.<br>
<br>
I should probably point out that I've not tried this myself, so I'd
advise caution and lots of experimentation. <br>
<blockquote
cite="mid:025976ec-568b-475c-aa54-234407194476@googlegroups.com"
type="cite">
<pre wrap="">_______________________________________________
rabbitmq-discuss mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a>
<a class="moz-txt-link-freetext" href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a>
</pre>
</blockquote>
<br>
</body>
</html>