Search code examples
javajmsjndi

List all queue names for a JMSBroker via jndi


I have created a Generic Java JMSBroker connector to monitor MQs and would like to add a method to be able to list all the available queues. I am using JNDI and javax.jms api.

Is there a generic way to do this for any provider?

I dont want provider specific api imports in my code.

Or this is not possible?


Solution

  • There is no way in the JMS API to cope with this. Many implementations has their ways to allow such things though. So you need to make custom logic for each JMS implementation that allows queue listing.

    Although no requirement for JMS, many JMS solutions define all (or at least some) queues and topics in a JNDI directory. If you know this is the case - you may ask that directory for all entries and look for queues.