You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Gilday <ma...@imap.cc> on 2008/04/01 11:57:59 UTC

Re: Request Reponse with Camel

I've drawn up a rough diagram to try and clear up what I am attempting
to describe. 
http://public.mgilday.imap.cc/routes.png

Here source 2 is a client (at the moment a Struts 2 action) which
performs some rudimentary operations through a Spring based service to
persist incoming data.  It then places a message which is destined for
trade.queue.  This is then consumed by a Spring service bean which
returns details of the trade.  This result should be returned to the
original client (the Struts 2 action).  However a based on the header or
content of the result it should also be placed on other JMS queues. 
This is the snippet I have in my concept so far:

from("test-jms:queue:test.queue")
.beanRef("tradingService", "trade")
.choice()
.when(header("source").isEqualTo("source2"))
.to("test-jms:queue:some.other.queue4")
.end();

The problem is that the client does not receive a response.  It seems to
wait until the message placed on some.other.queue4 is consumed.  Then
lots of "Future timed out" exceptions are thrown.

In your previous reply you mention placing onto a named queue/setting
the replyTo header rather than a temp queue.  If I did this I would have
to start correlating messages back to the correct client, which I don't
think I could do if I was going through a Spring remoting proxy.

I have found that my own headers set on the original message are not
maintained along the whole route.  Am I responsible for passing them
along the route myself, or can I say that a header going in to
TradingService should also be an outheader without copying it manually?

Thanks,
Martin

Re: Request Reponse with Camel

Posted by Martin Gilday <ma...@imap.cc>.
Sorry for bumping my own topic, but does anyone have any ideas of how to
implement this in Camel?


----- Original message -----
From: "Martin Gilday" <ma...@imap.cc>
To: camel-user@activemq.apache.org
Date: Tue, 01 Apr 2008 10:57:59 +0100
Subject: Re: Request Reponse with Camel

I've drawn up a rough diagram to try and clear up what I am attempting
to describe. 
http://public.mgilday.imap.cc/routes.png

Here source 2 is a client (at the moment a Struts 2 action) which
performs some rudimentary operations through a Spring based service to
persist incoming data.  It then places a message which is destined for
trade.queue.  This is then consumed by a Spring service bean which
returns details of the trade.  This result should be returned to the
original client (the Struts 2 action).  However a based on the header or
content of the result it should also be placed on other JMS queues. 
This is the snippet I have in my concept so far:

from("test-jms:queue:test.queue")
.beanRef("tradingService", "trade")
.choice()
.when(header("source").isEqualTo("source2"))
.to("test-jms:queue:some.other.queue4")
.end();

The problem is that the client does not receive a response.  It seems to
wait until the message placed on some.other.queue4 is consumed.  Then
lots of "Future timed out" exceptions are thrown.

In your previous reply you mention placing onto a named queue/setting
the replyTo header rather than a temp queue.  If I did this I would have
to start correlating messages back to the correct client, which I don't
think I could do if I was going through a Spring remoting proxy.

I have found that my own headers set on the original message are not
maintained along the whole route.  Am I responsible for passing them
along the route myself, or can I say that a header going in to
TradingService should also be an outheader without copying it manually?

Thanks,
Martin