1 2 Previous Next 15 Replies Latest reply on Jul 30, 2010 7:26 AM by Claus Ibsen

    CorrelationId and Camel

    Phil Waldron Newbie

      I have to connect to a weblogic JMS server with MessageID and CorrelationId.

       

      I would like to preset the CorrelationId. I have tried using ClientID:

       

       

       

      I have completed a line trace and the ID does not appear anywhere  in the Message Header.

       

      Can I set the CorrelationId and how?

       

      Thanks

       

      Phil

        • 1. Re: CorrelationId and Camel
          Claus Ibsen Master

          Just set a header with JMSCorrelationID as the key on the Camel Message before its sent to the JMS endpoint.

          • 2. Re: CorrelationId and Camel
            Phil Waldron Newbie

            I have found camel out of box great with ActiveMQ but I am struggling with this weblogic connection.

             

            I only use Spring and have no Java experience so my simple question HOW. There is no reference on the Web Site or Camel In Action.pdf,  if there is just quote page number.

             

            Thanks in advance for ur assistance

             

             

            Phil

            • 3. Re: CorrelationId and Camel
              Claus Ibsen Master

              You just use the setHeader DSL

               

              <setHeader headerName="JMSCorrelationID">
                  <constant>123</constant>
              </setHeader>
              

               

              Also check out the unit test of the jms component. For example this unit test

              https://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java

              • 4. Re: CorrelationId and Camel
                Phil Waldron Newbie

                I was looking for the most complicated solution, should have known with camel not to get the Hump.

                 

                Kind Regards

                 

                Phil

                • 5. Re: CorrelationId and Camel
                  Claus Ibsen Master

                  Yeah some Camel end user put it like that. If the solution seems to be to complex or to hard, then usually there is an easier way with Camel.

                   

                  If its still to hard, then speak up and we will make it easier. After all its the goal of Camel, to make your integration problems easier.

                  • 6. Re: CorrelationId and Camel
                    Kanna Muthukaruppan Newbie

                    I have a problem with the Request Reply queue. I want to be able to drop a message on to the request queue and then pick up the corresponding reply from the reply queue. I am using IBM Websphere MQ.

                     

                    My (Component / ArtifactId / URI) is like this

                    jms-mq:planRequestQueue?replyTo=planReplyQueue

                     

                    I have set ExchangePattern to InOut

                     

                    I can successfully drop a message on to planRequestQueue and receive the reply message on the planReplyQueue. However on the reply queue, the JMS connection (open input count) is NOT closed.

                     

                    I have tried adding transactedInOut but that does not even connect to the reply queue

                    jms-mq:planRequestQueue?replyTo=planReplyQueue&transactedInOut=true

                     

                    If I define them as 2 different routes how do I link them up with the correlation ID,

                     

                    Any input would be greatly appreciated.

                     

                    Edited by: kannappan123 on Apr 26, 2013 6:01 AM

                    • 7. Re: CorrelationId and Camel
                      Claus Ibsen Master

                      Why do you want the jms connection to close?

                       

                      Its usually the a combination of CACHE_LEVEL and connection pooling that controls the open/close behavior. See details and options at

                       

                      http://camel.apache.org/jms

                       

                      Such as

                      You can set the {{replyToCacheLevelName}} to NONE.

                      • 8. Re: CorrelationId and Camel
                        Kanna Muthukaruppan Newbie

                        Once I have read the response from the request/reply queue I want the physical connection from the application to the websphere mq to be closed.

                         

                        Currently it is not closed and as a result the "open input count" on  websphere mq constantly goes up with every reply  message.

                         

                        The application reaches the maximum number of connections set to 100 on the connection pool setting for the queue connection factory and stalls. As it cannot grow more than 100 and the connections are not release back to to the connection pool. I have attached the screen shot of queue connection factory configuration on Webpshere application container and also a screen shot showing the number of open connections.

                         

                        Edited by: kannappan123 on Apr 29, 2013 2:05 AM

                         

                        Edited by: kannappan123 on Apr 29, 2013 2:06 AM

                        • 9. Re: CorrelationId and Camel
                          Claus Ibsen Master

                          What version of Camel and WebSphere MQ are you using?

                          • 10. Re: CorrelationId and Camel
                            Kanna Muthukaruppan Newbie

                            The camel version is 2.10.3 and websphere MQ 7.0.0.1

                             

                            The connections does not seem to be closed even after setting replyToCacheLevelName to CACHE_NONE and cacheLevelName to CACHE_NONE

                             

                            Edited by: kannappan123 on Apr 29, 2013 6:05 AM

                            • 11. Re: CorrelationId and Camel
                              Claus Ibsen Master

                              Well you may have a connection pool in use, that don't physically close connections, as it wants to reuse connections.

                              • 12. Re: CorrelationId and Camel
                                Kanna Muthukaruppan Newbie

                                Hi Davsclaus,

                                 

                                That can't be, given that it closes the connection on the request (channel) queue, where the message produced by the java app is sent. The response is then received on the reply (Channel) queue.

                                 

                                My (Component / ArtifactId / URI) is like this :

                                jms-mq:instalmentPlanRequestQueue?replyTo=instalmentPlanReplyQueue&jmsMessageType=Text&useMessageIDAsCorrelationID=true

                                 

                                 

                                If you look at the previous screenshot, you will see that the number of open connections on the (Request) ITS.INS.DEV.INSTALMENTPLAN.REQ is 2. It goes up with every request but once the message is put in the channel it comes back down to 2.

                                 

                                Where as on the (Reply) ITS.INS.DEV.INSTALMENTPLAN.REPLY the open connections keep going up with every message received. The connection don't seem to be closed. This leads the MQ host to crash.

                                • 13. Re: CorrelationId and Camel
                                  Claus Ibsen Master

                                  Well its still all about how you configure the WebSphere MQ client / Camel JMS component.

                                   

                                  There are WebSphere MQ users using Camel successfully with no problems.

                                  • 14. Re: CorrelationId and Camel
                                    Kanna Muthukaruppan Newbie

                                    Hi Claus Ibsen,

                                    Yes I am one of them, I do have  Camel WebSphere MQ client working very well with no connection leaks for sending messages to a queue and few for receiving messages from the queue.

                                    However when I use the request/reply queue, that is I send (to request queue) and receive (from reply queue) using the same route is when I see the connection leaks on the reply queue only. The connections to request queue is all closed.

                                     

                                    I have set the  ExchangePattern set to InOut

                                    I have tried adding the following JmsConfiguration properties.

                                     

                                         

                                     

                                    but still not able to get the connection to close on the reply queue.

                                     

                                    I have tried setting transactedInOut=true, but this sends the message to the request queue but does not connect to the reply queue.

                                     

                                    I tried setting targetClient=1 but that does not even connect to the request queue

                                     

                                    If try defining them as 2 separate routes I am not sure how I can link the request and reply messages, ideally using the CorrelationID, some how.

                                     

                                    I am wondering if I am missing a configuration on the request/reply channel.

                                     

                                    Any input on this would be greatly appreciated.

                                     

                                    Regards

                                    Kanna

                                     

                                    Edited by: kannappan123 on Apr 30, 2013 6:38 AM

                                    1 2 Previous Next