You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Schneider Christian <Ch...@enbw.com> on 2010/02/26 16:54:15 UTC

Problem with JMS replyTo

Hi,

I have got two queues that listen for SOAP/JMS calls. The calls are request/reply and expect a reply on a temporary queue.
I want to feed requests from both queues into a common queue to serialize them.
Then I want to listen to the comon queue and process the requests.

The problem is that the replyTo header does not seem to get through to the common queue. So the jms Endpoint there is not able to send the reply back.
In the route I set disableReplyTo as I don´t want this route to reply to the sender or expect a reply. Still it should send the replyTo header as the listener on the common queue should send the reply.
The jms component documentation says that the jms component will clear the JMSReplyTo. In my case I really need it though. Any idea how to solve this?

Greetings

Christian


from("jms://" + destCustomerService + "?disableReplyTo=true") //
                .setHeader(HEADER_ORIG_DEST, constant(destCustomerService)) //
                .to("jms://" + destCommonQueue + "?disableReplyTo=true");
        from("jms://" + destDealService + "?disableReplyTo=true") //
                .setHeader(HEADER_ORIG_DEST, constant(destDealService)) //
                .to("jms://" + destCommonQueue + "?disableReplyTo=true");
        from("jms://" + destCommonQueue) //
                .process(new MyProcessor())
                .choice() //
                .when(header(HEADER_ORIG_DEST).isEqualTo(destCustomerService)).to("direct:customerService") //
                .when(header(HEADER_ORIG_DEST).isEqualTo(destCustomerService)).to("direct:dealService") //
                .otherwise().to("jms://queue.deadLetter")
                .end();




Christian Schneider
Team Handel und Risikomanagement
Informationsverarbeitung Business Solutions Trading
EnBW Systeme Infrastruktur Support GmbH

Informationsverarbeitung
Business Solutions
Handel und Dispatching
Durlacher Allee 93
76131 Karlsruhe

Tel : +49-(0)721-63-15482
Mail: christian.schneider@enbw.com

EnBW Systeme Infrastruktur Support GmbH
Sitz der Gesellschaft: Karlsruhe
Handelsregister: Amtsgericht Mannheim ‑ HRB 108550
Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck
Geschäftsführer: Jochen Adenau, Hans-Günther Meier




Re: Problem with JMS replyTo

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Feb 27, 2010 at 4:18 PM, Christian Schneider
<ch...@die-schneider.net> wrote:
> Am 27.02.2010 12:44, schrieb Claus Ibsen:
>>
>> On Fri, Feb 26, 2010 at 8:47 PM, Christian Schneider
>> <ch...@die-schneider.net>  wrote:
>>
>>>
>>> I was able to resolve the problem. In my jms config I had used the option
>>> useMessageIdAsCorrelationId. As the forwarded message has a different
>>> correlation id than the original message the client could not process the
>>> response. Besides that I had a typo in the config I posted.
>>>
>>> On the other hand it seems to me the documentation that says the
>>> JMSReplyTo
>>> is cleared is not correct. The JMSReplyTo header was correctly set on the
>>> forwarded messsage. Should I correct this in the documentation?
>>>
>>>
>>
>> Can you point out in the documentation where you see this, and why you
>> think its wrong?
>>
>>
>
> Hi Claus,
>
> the documentation I talk about is in http://camel.apache.org/jms.html.
> The Chapter is named: About using Camel to send and receive messages and
> JMSReplyTo
> In the subchapter JmsProducer there is a table which says:
> "InOnly, JMSReplyTo is set, Camel sees this as a contradiction and will
> suppress the JMSReplyTo. In fact, Camel will disable it by clearing it
> before sending. ..."
>
> I used the option disableReplyTo. This option says that the messages are
> treated as InOnly.
> So my case is that I have an InOnly message and the JMSReplyTo is set. In my
> JmsProducer the JMSReplyTo is not cleared as I would have expected from the
> documentation. (Which is a good thing for me as clearing JMSReplyTo would
> make it much harder to forward request/reply style requests to another
> queue.
>
> It is of course possible that I missunderstood something here.
>

Its only *treated* as if it was InOnly but its still an InOut.

I think you can add to the documentation that when you also use
disableReplyTo=true then it works as follows ....





> Greetings
>
> Christian
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Problem with JMS replyTo

Posted by Christian Schneider <ch...@die-schneider.net>.
Am 27.02.2010 12:44, schrieb Claus Ibsen:
> On Fri, Feb 26, 2010 at 8:47 PM, Christian Schneider
> <ch...@die-schneider.net>  wrote:
>    
>> I was able to resolve the problem. In my jms config I had used the option
>> useMessageIdAsCorrelationId. As the forwarded message has a different
>> correlation id than the original message the client could not process the
>> response. Besides that I had a typo in the config I posted.
>>
>> On the other hand it seems to me the documentation that says the JMSReplyTo
>> is cleared is not correct. The JMSReplyTo header was correctly set on the
>> forwarded messsage. Should I correct this in the documentation?
>>
>>      
> Can you point out in the documentation where you see this, and why you
> think its wrong?
>
>    
Hi Claus,

the documentation I talk about is in http://camel.apache.org/jms.html.
The Chapter is named: About using Camel to send and receive messages and 
JMSReplyTo
In the subchapter JmsProducer there is a table which says:
"InOnly, JMSReplyTo is set, Camel sees this as a contradiction and will 
suppress the JMSReplyTo. In fact, Camel will disable it by clearing it 
before sending. ..."

I used the option disableReplyTo. This option says that the messages are 
treated as InOnly.
So my case is that I have an InOnly message and the JMSReplyTo is set. 
In my JmsProducer the JMSReplyTo is not cleared as I would have expected 
from the documentation. (Which is a good thing for me as clearing 
JMSReplyTo would make it much harder to forward request/reply style 
requests to another queue.

It is of course possible that I missunderstood something here.

Greetings

Christian


Re: Problem with JMS replyTo

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Feb 26, 2010 at 8:47 PM, Christian Schneider
<ch...@die-schneider.net> wrote:
> I was able to resolve the problem. In my jms config I had used the option
> useMessageIdAsCorrelationId. As the forwarded message has a different
> correlation id than the original message the client could not process the
> response. Besides that I had a typo in the config I posted.
>
> On the other hand it seems to me the documentation that says the JMSReplyTo
> is cleared is not correct. The JMSReplyTo header was correctly set on the
> forwarded messsage. Should I correct this in the documentation?
>

Can you point out in the documentation where you see this, and why you
think its wrong?


> Greetings
>
> Christian
>
>
> Am 26.02.2010 16:54, schrieb Schneider Christian:
>>
>> Hi,
>>
>> I have got two queues that listen for SOAP/JMS calls. The calls are
>> request/reply and expect a reply on a temporary queue.
>> I want to feed requests from both queues into a common queue to serialize
>> them.
>> Then I want to listen to the comon queue and process the requests.
>>
>> The problem is that the replyTo header does not seem to get through to the
>> common queue. So the jms Endpoint there is not able to send the reply back.
>> In the route I set disableReplyTo as I don´t want this route to reply to
>> the sender or expect a reply. Still it should send the replyTo header as the
>> listener on the common queue should send the reply.
>> The jms component documentation says that the jms component will clear the
>> JMSReplyTo. In my case I really need it though. Any idea how to solve this?
>>
>> Greetings
>>
>> Christian
>>
>>
>> from("jms://" + destCustomerService + "?disableReplyTo=true") //
>>                 .setHeader(HEADER_ORIG_DEST,
>> constant(destCustomerService)) //
>>                 .to("jms://" + destCommonQueue + "?disableReplyTo=true");
>>         from("jms://" + destDealService + "?disableReplyTo=true") //
>>                 .setHeader(HEADER_ORIG_DEST, constant(destDealService)) //
>>                 .to("jms://" + destCommonQueue + "?disableReplyTo=true");
>>         from("jms://" + destCommonQueue) //
>>                 .process(new MyProcessor())
>>                 .choice() //
>>
>> .when(header(HEADER_ORIG_DEST).isEqualTo(destCustomerService)).to("direct:customerService")
>> //
>>
>> .when(header(HEADER_ORIG_DEST).isEqualTo(destCustomerService)).to("direct:dealService")
>> //
>>                 .otherwise().to("jms://queue.deadLetter")
>>                 .end();
>>
>>
>>
>>
>>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Problem with JMS replyTo

Posted by Christian Schneider <ch...@die-schneider.net>.
I was able to resolve the problem. In my jms config I had used the 
option useMessageIdAsCorrelationId. As the forwarded message has a 
different correlation id than the original message the client could not 
process the response. Besides that I had a typo in the config I posted.

On the other hand it seems to me the documentation that says the 
JMSReplyTo is cleared is not correct. The JMSReplyTo header was 
correctly set on the forwarded messsage. Should I correct this in the 
documentation?

Greetings

Christian


Am 26.02.2010 16:54, schrieb Schneider Christian:
> Hi,
>
> I have got two queues that listen for SOAP/JMS calls. The calls are request/reply and expect a reply on a temporary queue.
> I want to feed requests from both queues into a common queue to serialize them.
> Then I want to listen to the comon queue and process the requests.
>
> The problem is that the replyTo header does not seem to get through to the common queue. So the jms Endpoint there is not able to send the reply back.
> In the route I set disableReplyTo as I don´t want this route to reply to the sender or expect a reply. Still it should send the replyTo header as the listener on the common queue should send the reply.
> The jms component documentation says that the jms component will clear the JMSReplyTo. In my case I really need it though. Any idea how to solve this?
>
> Greetings
>
> Christian
>
>
> from("jms://" + destCustomerService + "?disableReplyTo=true") //
>                  .setHeader(HEADER_ORIG_DEST, constant(destCustomerService)) //
>                  .to("jms://" + destCommonQueue + "?disableReplyTo=true");
>          from("jms://" + destDealService + "?disableReplyTo=true") //
>                  .setHeader(HEADER_ORIG_DEST, constant(destDealService)) //
>                  .to("jms://" + destCommonQueue + "?disableReplyTo=true");
>          from("jms://" + destCommonQueue) //
>                  .process(new MyProcessor())
>                  .choice() //
>                  .when(header(HEADER_ORIG_DEST).isEqualTo(destCustomerService)).to("direct:customerService") //
>                  .when(header(HEADER_ORIG_DEST).isEqualTo(destCustomerService)).to("direct:dealService") //
>                  .otherwise().to("jms://queue.deadLetter")
>                  .end();
>
>
>
>
>