3 Replies Latest reply on Jan 14, 2003 5:30 AM by Paul Bandler

    Accessing different JMS Servers

    Dave Morris Newbie

      How do you access a local and remote JBoss JMS Servers in the same java class?

      I have a class that accesses the correct JMS Server via the JNDI properties. However, when I want to access a different JMS Server by setting enviromental variables using "new InitialContext(remoteEnv)" I cannot access a different JMS Server...only the one defined where the JNDI properties file is located.

        • 1. Re: Accessing different JMS Servers
          Jon Ferguson Newbie

          Hi,

          Have you tried the remote connection without the local one concurrently? I've managed to do what you suggest using just the remote connection..

          However, I've been wondering about the architecture of this approach.. Does it make sense to use a Federated JNDI server with queues on various local machines? In my case the connection between the 2 is a dial-up so I need queues on each side for caching sent messages..

          Cheers,
          Jon

          • 2. Re: Accessing different JMS Servers
            Jon Ferguson Newbie

            Hey there's another way that is done when using Sun's J2EE reference edition. Basically you deploy an extra ConnectionFactory that has been configured to link to the other machine. Then you just grab JNDI to map the one you want.

            To me, this solution feels right and I would expect something similar (or better!) in JBoss - I just haven't found it yet!!

            Cheers,
            Jon

            • 3. Re: Accessing different JMS Servers
              Paul Bandler Newbie

              Did either of you find a fully satisfactory solution for this issue?

              I have the same need and have assumed (but not yet tested)that creating an InitialContext with the remote host as the PROVIDER_URL then doing something like:
              ctx.lookup("java:comp/env/jms/DestinationConnectionFactory");

              where the ejb-jar.xml contains:

              <resource-ref>
              <res-ref-name>jms/DestinationConnectionFactory
              </res-ref-name>
              <res-type>javax.jms.QueueConnectionFactory</res-type>
              <res-auth>Container</res-auth>
              </resource-ref>

              && in jboss.xml

              <resource-ref>
              <res-ref-name>jms/DestinationConnectionFactory
              </res-ref-name>
              <jndi-name>ConnectionFactory</jndi-name>
              </resource-ref>
              Would look up the remote connection factory (ConnectionFactory) on the remote machine - is this okay and is there a better way?

              rgds,

              Paul Bandler
              Uk