Java – Determine number of subscribers per topic in JMS

javajms

I'm building a small statistics application for Java Message Service. I have a container with several topic and loads of subscribers (consumers) to each topic.

JMS provider: SonicMQ

I've gotten the program to the state where I:

  1. Create a session
  2. Create a MessageConsumer to the topic
  3. Listen for messages
  4. Collect the statistics

And it's working ok.

But a key piece of the program is missing: How to determine the number of subscribers a certain topic has?

I've plowed through the JMS documentation, but to no avail. I was hoping maybe someone has battled this windmill before… Any ideas or a confirmation that it cannot be done welcome.

Best Answer

This sort of information isn't going to be available via the JMS API itself. You may have better luck talking to the JMS implementation's native API, although you don't mention what that implementation is.

Related Topic