3 Replies Latest reply on May 13, 2009 4:13 AM by ezanih

    Need clarification on destination for JMSRouter Quickstart E

    ezanih

      Hi there

      I am a newbie at JBoss ESB and I was trying out the JMSRouter Quickstart sample. I fail to understand what argument I should pass to args[1] in this line of code in the sample :

      SendJMSMessage sm = new SendJMSMessage();
      sm.setupConnection(args[1]);
      



      The setupConnection method is as follows :-

       public void setupConnection(String destination) throws JMSException, NamingException
       {
       InitialContext iniCtx = new InitialContext();
      
       ConnectionFactory connectionFactory = (ConnectionFactory) iniCtx.lookup("ConnectionFactory");
      
       connection = connectionFactory.createConnection();
      
       gatewayDestination = (Destination) iniCtx.lookup("queue/quickstart_jms_router_Request_gw");
       responseDestination = (Destination)iniCtx.lookup(destination);
       replyToDestination = (Destination) iniCtx.lookup("queue/quickstart_jms_router_replyToQueue");
       session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
       connection.start();
       System.out.println("Connection Started");
       }
      


      Could anyone who knows about this quickstart sample tell me what argument I should send to args[1] ?

      Many thanks!

        • 1. Re: Need clarification on destination for JMSRouter Quicksta
          scottdawson

          Look at the "runtest" target in build.xml and you'll see values you can use for the 2 arguments. In fact, "ant runtest" will do it for you. According to build.xml, the value for the second argument should be queue/quickstart_jms_router_routeTo.

          Regards,
          Scott

          • 2. Re: Need clarification on destination for JMSRouter Quicksta
            ezanih

            Ok, I got it to work. Just a short question: why do we need a Correlation ID ? We already have a Message ID which uniquely identifies the message so why do we need a Correlation ID ? What is a Correlation ID and what is a Message ID ? What is the difference between the two ?

            Many thks!

            • 3. Re: Need clarification on destination for JMSRouter Quicksta
              ezanih

              Ok, I answered my own question which could easily be gotten from the Internet, which I'll share with you all.

              Basically a Correlation ID allows a requestor who has sent several requests each of which requires responses, to match which response to which request.

              As we all know, each message (whether request or response) has a MessageID. When responding to a request, just set the Correlation ID of the response to the original request's MessageID, and hey presto! you have a way to match a response to the original request!