You can do it via JMX. You can use an XPATH expression against http://broker:8161/admin/xml/queues.jsp if you have the admin console installed. If you have access to the Broker object you can call broker.getDestinations(activeMQdestination) which is a set of Destination objects you can call getDestinationStatistics() on to get the enqueues, dequeues, count, etc... for.
Unfortuantely, if all you have is a connection, session, and queue, the only way I've found is to use the session to get a QueueBrowser and iterate through the messages it enumerates. It'd be really cool if you there was a way to get a destination statistics object via a connection or session, but I don't think it presently exists. Praveen Kumar Jayaram wrote: > Hi,<br><br> > > Is it possible to get the current number of messages in a particular queue > in ActiveMQ 5.2.0?<br> > Am just asking a dumb question here...Will that RSS feeds provided expose > this feature? > :-) > <br> > regards,<br> > Praveen > -- View this message in context: http://www.nabble.com/Getting-count-of-messages-in-a-queue-%28ActiveMQ-5.2.0%29-tp22072169p24142325.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.