7 Replies Latest reply on Jul 13, 2007 4:55 AM by marklittle

    JMSHeader fields

    beve

      Hi,

      I'm working on JIRA http://jira.jboss.com/jira/browse/JBESB-651 and would like to know how JMSHeader fields should be transported with a Message object in the ESB.

      I've identified the following JMSHeader fields that might be of interest.


      JMSMessageID -> message.getHeader().getCall().getMessageID()
      JMSCorrelationID -> message.getHeader().getCall().getRelatesTo() );

      JMSReplyTo should propably be mapped to message.getHeader().getCall().getReplyTo() but I'm not sure how I should set/create the JMSEpr. Can anyone help me out?

      I have another JIRA that is related to this one which is the JMSRouter. I've added the following method to this class:
      protected void setJMSProperties( Message jmsMessage, org.jboss.soa.esb.message.Message esbMsg )
      throws JMSException
      {
       jmsMessage.setJMSCorrelationID( esbMsg.getHeader().getCall().getRelatesTo().toString() );
      }
      

      Now this will set the out going JMS message correlationID to the JMSMessageID that has been carried along with the Message object. This is probably ok for most user but this will also let other that have different needs subclass JMSRouter and overrride this method.

      While writing unit test for this I noticted that the test JmsRouterUnitTest is trying to connect to a server, and if one is not running it will time out:
      [java] [junit] Running org.jboss.soa.esb.actions.routing.JmsRouterUnitTest
      [java] [junit] Testsuite: org.jboss.soa.esb.actions.routing.JmsRouterUnitTest
      [java] [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 80.874 sec
      [java] [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 80.874 sec
      

      Recactoring this junit test might speed up the build :)

      Thanks,

      Daniel

        • 1. Re: JMSHeader fields
          marklittle

           

          "beve" wrote:
          Hi,

          I'm working on JIRA http://jira.jboss.com/jira/browse/JBESB-651 and would like to know how JMSHeader fields should be transported with a Message object in the ESB.

          I've identified the following JMSHeader fields that might be of interest.

          JMSMessageID -> message.getHeader().getCall().getMessageID()
          JMSCorrelationID -> message.getHeader().getCall().getRelatesTo() );



          Yes, that sounds right to me. Since we have the capability in the EPR, let's use that rather than stuff the information in the message body.


          JMSReplyTo should propably be mapped to message.getHeader().getCall().getReplyTo() but I'm not sure how I should set/create the JMSEpr. Can anyone help me out?


          What's the problem specifically?


          I have another JIRA that is related to this one which is the JMSRouter. I've added the following method to this class:
          protected void setJMSProperties( Message jmsMessage, org.jboss.soa.esb.message.Message esbMsg )
          throws JMSException
          {
           jmsMessage.setJMSCorrelationID( esbMsg.getHeader().getCall().getRelatesTo().toString() );
          }
          

          Now this will set the out going JMS message correlationID to the JMSMessageID that has been carried along with the Message object. This is probably ok for most user but this will also let other that have different needs subclass JMSRouter and overrride this method.

          While writing unit test for this I noticted that the test JmsRouterUnitTest is trying to connect to a server, and if one is not running it will time out:
          [java] [junit] Running org.jboss.soa.esb.actions.routing.JmsRouterUnitTest
          [java] [junit] Testsuite: org.jboss.soa.esb.actions.routing.JmsRouterUnitTest
          [java] [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 80.874 sec
          [java] [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 80.874 sec
          

          Recactoring this junit test might speed up the build :)

          Thanks,

          Daniel


          It should probably be an integration test anyway.

          • 2. Re: JMSHeader fields
            beve

             


            What's the problem specifically?

            Well, this is how I'm currently doing it:
            if (jmsMsg.getJMSReplyTo()!=null)
            {
             Destination replyToDestination = jmsMsg.getJMSReplyTo();
             String destType = null;
             String destName = null;
             String connection = "ConnectionFactory";
             if ( replyToDestination instanceof Queue )
             {
             Queue queue = ( Queue ) replyToDestination;
             destName = queue.getQueueName();
             destType = JMSEpr.QUEUE_TYPE;
             }
             else
             {
             Topic topic = ( Topic ) replyToDestination;
             destName = topic.getTopicName();
             destType = JMSEpr.TOPIC_TYPE;
             }
             message.getHeader().getCall().setReplyTo( new JMSEpr( destType , destName, connection );
            

            I'm a bit concerned about the connection variable. I looks like this should be a connection factory, but should it be normal one or a clustered connection factory. Maybe I should get this from the configuration file?

            /Daniel

            • 3. Re: JMSHeader fields
              marklittle

               

              "beve" wrote:
              I'm a bit concerned about the connection variable. I looks like this should be a connection factory, but should it be normal one or a clustered connection factory. Maybe I should get this from the configuration file?


              The current code seems to obtain it via the configuration file. Best to stick with that for now IMO.

              • 4. Re: JMSHeader fields
                beve

                 

                The current code seems to obtain it via the configuration file. Best to stick with that for now IMO.

                Configuration it is then.

                Should I rename JmsRouterUnitTest to JmsRouterIntegrationTest?

                Daniel

                • 5. Re: JMSHeader fields
                  marklittle

                  I think so.

                  • 6. Re: JMSHeader fields
                    bill.burke

                    Off topic, but related, but maybe it would be better for ESB Message interface to have a similar hierarchy to JMS? What I mean is:

                    Message
                    |
                    ObjectMessage, StringMessage, MapMessage

                    We know that ESB has a richer message semantic, but from what I saw a few months ago, its has a one-interface-fits all for its payload.

                    Just a thought.

                    • 7. Re: JMSHeader fields
                      marklittle

                       

                      "bill.burke@jboss.com" wrote:
                      Off topic, but related, but maybe it would be better for ESB Message interface to have a similar hierarchy to JMS? What I mean is:

                      Message
                      |
                      ObjectMessage, StringMessage, MapMessage

                      We know that ESB has a richer message semantic, but from what I saw a few months ago, its has a one-interface-fits all for its payload.

                      Just a thought.


                      Interesting. I've created a JIRA http://jira.jboss.com/jira/browse/JBESB-684 so we don't lose this one.