0 Replies Latest reply on Nov 30, 2015 10:29 AM by kc7bfi

    Listening for JMS messages in a remote AS5.1 server from code in another AS5.1 server


      I have code running in my local AS5.1 server that is trying to connect and listen for JMS topic messages in a queue on a remote AS5.1 server. The topic exists in both servers but I want a listener that distinguishes between local messages and messages received from the remote server. I can use JNDI to find the ConnectionFactory in the remote server but when I try to create a JMS session from that factory and then listen to the topic I seem to only listen for topics from my local server. I never seem to get messages from the remote server. It appears that the JMS system finds the topic name locally and never attaches a listener to the remote topic. Any idea what I may be doing wrong? I find the remote ConnectionFactory with the following code


      Properties jndiProperties = new Properties();

      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

      jndiProperties.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");

      jndiProperties.put("jnp.timeout", "2000");

      jndiProperties.put("jnp.sotimeout", "2000");

      jndiProperties.put("jnp.disableDiscovery", "true");

      jndiProperties.put(Context.PROVIDER_URL, server1 + ":1100," +server2 + ":1100"); // HA-JNDI port.

      clusterContext = new InitialContext(jndiProperties);

      ConnectionFactory jmsConnectionFactory = (ConnectionFactory)clusterContext.lookup("/ConnectionFactory");

      jmsConnection = jmsConnectionFactory.createConnection();



      jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);


      Should this be correct? David