3 Replies Latest reply on Jun 11, 2012 9:38 AM by RobertMetcalf

    API to list Uniform Distributed Queue JMS Servers

      Hi all,

      I posted this in the SOA suite forum but this one may be better.

      I am writing a POJO webservice to synchronously read a message from a JMS queue. Unfortunately the queue is actually a uniform distributed queue so I actually need to look for messages in each of the local queues.

      I have written code to find the JNDI names of the local queues as follows:
      StringArray DistribMemberNames = new StringArray();
      String ttt;
      ttt = JMSHelper.uddMemberJNDIName("IMPJMSServer_1", part1.getJNDIName());

      ttt = JMSHelper.uddMemberJNDIName("IMPJMSServer_2", part1.getJNDIName());

      This works fine but I have hard coded the names of the JMS Servers and this is bad practice. I need to find a method where I can take the JNDI name of the uniform distributed queue and find all the JMSServer names. I have been looking for days but I can’t find anywhere in the API documentation that describes this.
      Does anyone have any suggestions?


      (I am using on a clustered weblogic enviroment)
        • 1. Re: API to list Uniform Distributed Queue JMS Servers
          I have managed to answer this question myself.
          I needed to create a context:

          Hashtable env = new Hashtable();
          env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
          m_jndiContext = new InitialContext(env);

          Look up the main runtime mbean

          MBeanServer server;
          server = (MBeanServer) m_jndiContext.lookup("java:comp/env/jmx/runtime");

          Navigate down the domain configuration to get the JMSServers

          ObjectName service = null;
          ObjectName domainConfiguration = null;
          ObjectName[] jmsServers = null;

          service = new ObjectName(
          + "Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");

          domainConfiguration = (ObjectName) server.getAttribute(service, "DomainConfiguration");
          jmsServers = (ObjectName[]) server.getAttribute(domainConfiguration, "JMSServers");

          For each server you can retrive it's name:

          for (int i = 0; i < length_serverRT; i++) {
          String jmsServerName = "";
          jmsServerName = (String) server.getAttribute(serverRT, "Name");

          I had to do some additional filtering for my own requirements
          • 2. Re: API to list Uniform Distributed Queue JMS Servers
            Thanks for posting back. The next time use \
             tags to format the code; not only does it make it more readable, it prevents the forum from trying to interpret special characters.                                                                                                                                                                                                                                                                                                                                                                            
            1 person found this helpful
            • 3. Re: API to list Uniform Distributed Queue JMS Servers
              Thanks - I will keep this in mind