<div dir="ltr"><div>Hi,</div><div><br></div>I'd guess this could be attempted using queue length: <a href="http://www.rabbitmq.com/maxlength.html">http://www.rabbitmq.com/maxlength.html</a> and setting up a separate dead letter queue for that 5000th message.<div>
<br></div><div>Regards,</div><div><br></div><div>Alvaro</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jun 1, 2014 at 3:37 PM, Michael Klishin <span dir="ltr"><<a href="mailto:mklishin@gopivotal.com" target="_blank">mklishin@gopivotal.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 1 June 2014 at 17:34:11, rails (<a href="mailto:stammailbox@gmail.com">stammailbox@gmail.com</a>) wrote:<br>
> > 1. What is the best practice to get the number of messages in a<br>
> queue.<br>
> I know I can get it via queue.getMessageCount()<br>
<br>
</div>Do a queue.declare (possibly with passive = true), check # of messages ready from<br>
queue.declare-ok. You can also query queue stats using HTTP API.<br>
<div class=""><br>
> What is the best way if I want to react only when X messages arrive? <br>
<br>
</div>Add a consumer and process deliveries in batches in your own code.<br>
<div class=""><br>
> 2. And more important - can I get the number of messages in a queue<br>
> via push?<br>
<br>
</div>There is no such feature in RabbitMQ. You have to periodically check the counter.<br>
--<br>
MK<br>
<br>
Software Engineer, Pivotal/RabbitMQ<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br></div>