ability to get the count in a queue AND/OR know if a queue is empty
oDevArc opened this issue · 4 comments
It would be nice to have the ability to get the count in a queue AND/OR know if a queue is empty.
A new commuters :
--get_count -N
: return integer of count : -1 is queue does not exist
--is_empty -Z
: return 1 for empty queue / 0 not empty : -1 is queue does not exist
thank U for your nice work
Count is impossible using the JMS API alone, which A is limited to. The reason is to be able to work with as many installations as possible with the potential same rights as the application, without JMX requirements. However, is empty, is probably possible by browsing the queue and if no results it's empty. Counting with browse will read each message, which is fine if there are like 10 1KB messages but won't work for thousand of messages. There is a hard cap of, usually, 400 msgs per browse as well. Can be configured to a higher level server side, but annoyingly hard to use for tools like this.
Hi, when you say "is empty, is probably possible by browsing the queue" : sorry for the dummy question : but how can web "browse a queue" WITHOUT do a GET (which read messages and pull them out the server queue) ?
The web admin console uses JMX - a different way to connect to ActiveMQ for management tools. The JMX interface has some nice features such as listing, purge, queue sizes etc. A does not use JMX since it’s not enabled for remote connections on all AMQ installations.
I don't see a way to implement count over the JMS API - even though I see the need for something like that. While a simple "is empty" can be emulated with a browse with count 1 and checking the result for messages, it still is not totally clear what a count really is. In a "network of brokers" scenario - the same queue can be spread out over multiple brokers with messages flowing to consumers connected to each of them. What does a count even mean in that case?
However, if there is a need for some other type of "is empty" command, I gladly merge a PR