3 Replies Latest reply on Jul 24, 2009 3:22 AM by Frank Henry

    HA-JNDI for JMS

    Jason Greiner Newbie

      HA JNDI and JMS

      JBoss 4.3

      I have 2 clusters that I need to publish a topic on. I can get it all working setting the environment variables for the initial context and giving it the server names.

      Hashtable<String, String> env = new Hashtable<String, String>();
      env.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      env.put("java.naming.factory.url.pkgs","org.jboss.naming=org.jnp.interfaces");
      env.put("java.naming.provider.url","server1:1100,server2:1100");
      


      However I do not want to hard code server names in my code. Is it possible to add a HA-JNDI jms connection data source that i can then look up on the server? From my readings it seems possible, but I have been unable to find an example of setting up a hajndi jms connection or good documentation.

      I would like to keep my default jms provider as well so that I do not break any existing code. If someone could provide me some direction or point me to some GOOD documentation I would appreciate it.

      thanks

        • 1. Re: HA-JNDI for JMS
          Frank Henry Novice

          Is this on the server's side only?
          Then you can use your own ip. i.e. ${bind.address}

           p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
           p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
           p.put(Context.PROVIDER_URL, System.getProperty("bind.address") + ":1100"); // HA-JNDI port.
          



          • 2. Re: HA-JNDI for JMS
            Jason Greiner Newbie

            Well it is on a server. But I think you misunderstood my question.

            I have a cluster with 3 servers. I can post to the topic and it works just fine, all 3 servers process my request.

            Now I want to post to a REMOTE Cluster. I can use the code in my example to post to the 3 servers in the remote cluster. However I do not want the servers hard coded, I would rather make them a configuration value on jboss either using jndi or creating a topic destination and providing the server list via a parameter or attribute. However I am finding it hard to locate any documentation supporting this.

            Seems like a topic for the jboss messaging forum. I posted here since I was working with a remote cluster.

            • 3. Re: HA-JNDI for JMS
              Frank Henry Novice

              Ah, ok.

              Can the cluster lookup not help you there?
              IIRC there is an option to supply the port as well.