rabbitmq - Queue Size in Spring AMQP Java client -


I am using Spring AMPP version 1.1 as my Java client. I have a line, which has about 2000 messages, I want a service that checks the size of this queue and if it is empty then it will send a message saying "all items processed".

I do not know how to get the current queue size? Please help

I googled and found a square "RabbitBrokerAdmin" which was present in earlier version 1.0. I think it's not present in 1.1 yet.

Any hint in the size of the current queue?

So I know that this is a little late and a solution has already been found but here Another way is

This solution assumes that you are using Spring Rabbit Framework and defined your queues in your application config with the following tags defined

  & Lt; Rabbit: queue & gt; & Lt; Rabbit: admin & gt;   

Java class:

  Public class questsstats processor {@ etvoir private rebate admin admin; @ Autonomous private list & lt; Que & gt; RabbitQueues; Public Zero GetCounts () {property property; Integer messagecount; (For queue queue: Rabbit ones) {props = admin.getQueueProperties (queue.getName ()); MessageCount = integerParsInt (Props ("QUEUE_MESSAGE_COUNT"). ToString ()); System.out.println (queue.getName () + "is" + MessageCount + "Message");   

You can also use this solution to read existing users connected to Qi

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -