4 Replies Latest reply on Jul 25, 2007 4:18 PM by timfox

    JMS Example?

    hibsmax

      Hi, Group.

      Does anyone know if there are any JBoss / JMS Messaging examples that give an idea of how to send a message from an HTTPServlet to a JMS destination residing on a remote JBoss server i.e. a servlet running in JBoss on server1 accessing a JMS destination on JBoss on server2 (different hardware servers, same network)?

      Thanks, Anders

        • 1. Re: JMS Example?
          hibsmax

          I should have said that the servlet is running on one JBoss cluster, the destinations are hosted on another, separate cluster. The two JBoss clusters are completely separate.

          • 2. Re: JMS Example?
            timfox

            In the examples there's an example of sending a message from a web service (a servlet).

            You just need to deploy a JMSProviderLoader pointing to your remote provider (there should be some wiki pages about this), then make sure you lookup the connection factory corresponding to this provide.

            Should be pretty straightforward - this is a very common use case.

            • 3. Re: JMS Example?
              hibsmax

              Thanks, Tim.

              I agree it's straightforward and common but I don't seem to be able to get it to work for some reason. When I have my servlets, destinations and MDB deployed in the same cluster and use:
              InitialContext ctx = new InitialContext();

              I can access my destinations just fine.

              (note: all the examples in the JBoss Messaging 1.3 doc use the same method of creating an InitialContext as shown above, none specify a URL belonging to a remote machine).



              When I move the servlet to cluster1 and the destinations / MDB to cluster2, it stops working. I tried creating the InitialContext with a PROVIDER_URL that pointed Cluster2 i.e.

              Properties h = new Properties();
              h.put( Context.PROVIDER_URL, "jnp://cluster2:1099" );
              InitialContext ctx = new InitialContext(h);

              but this didn't work.

              The application works if everything is deployed to a single JBoss server or to a single JBoss cluster but I can't get cluster to cluster working. That's the example I am looking for.

              Peace, Anders

              • 4. Re: JMS Example?
                timfox