You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yaog <ya...@gmail.com> on 2009/12/30 09:13:19 UTC

How to InOut with JMs

Hi,

I have a route like this:

<camelContext id="camel" trace="true"
xmlns="http://camel.apache.org/schema/spring">
		<camel:template id="camelTemplate" />
		<route>
			<from uri="direct:start" />
			<to uri="bean:compA?method=start1" />			
			<to uri="bean:compB" />
			<to uri="bean:myRMIClient1"/>
			<to uri="jms:infratest"/>			
			<to uri="bean:myListener" />
		</route>
	</camelContext>


On the one hand in the end I send a jms message. On the other hand I want an
InOut pattern so my main will get back the result from "bean:myRMIClient1".

Can anyone advise how can this be achieved?


-- 
View this message in context: http://old.nabble.com/How-to-InOut-with-JMs-tp26965017p26965017.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to InOut with JMs

Posted by Claus Ibsen <cl...@gmail.com>.
Try looking at the wireTap EIP pattern to fork the message.


On Wed, Dec 30, 2009 at 4:15 PM, yaog <ya...@gmail.com> wrote:
>
> I guess I wasn't clear.
>
> I want to fork the route. I want the first part to reply, but after sending
> a message to the queue I am not expecting a response.
>
> I tries defining 2 routes but it didn't help.
> --
> View this message in context: http://old.nabble.com/How-to-InOut-with-JMs-tp26965017p26968487.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
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: How to InOut with JMs

Posted by yaog <ya...@gmail.com>.
I guess I wasn't clear.

I want to fork the route. I want the first part to reply, but after sending
a message to the queue I am not expecting a response.

I tries defining 2 routes but it didn't help.
-- 
View this message in context: http://old.nabble.com/How-to-InOut-with-JMs-tp26965017p26968487.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to InOut with JMs

Posted by Ryadh Amar <ma...@gmail.com>.
By guessing, I suppose that you're going to use the camelTemplate to send
stuff to "direct:start",
It is enough to do something like:
		ProducerTemplate camelTemplate =
(ProducerTemplate)context.getBean("template");
		Object returnValue = camelTemplate.requestBody("direct:start");
By just calling requestBody instead of sendBody, you're effectively setting
the InOut mep, so when the message reaches the jms endpoint, it will expect
the message broker to come up with a reply, and send back the message to the
caller i.e. returnValue in the snippet above.
One thing I don't get in your route, is the "bean:myListener", I am curious
to know if what is sent back from the "infratest" queue gets send to the
next bean component and finally is sent back to the call initiated by the
camelTemplate...
HTH.


yaog wrote:
> 
> Hi,
> 
> I have a route like this:
> 
> <camelContext id="camel" trace="true"
> xmlns="http://camel.apache.org/schema/spring">
> 		<camel:template id="camelTemplate" />
> 		<route>
> 			<from uri="direct:start" />
> 			<to uri="bean:compA?method=start1" />			
> 			<to uri="bean:compB" />
> 			<to uri="bean:myRMIClient1"/>
> 			<to uri="jms:infratest"/>			
> 			<to uri="bean:myListener" />
> 		</route>
> 	</camelContext>
> 
> 
> On the one hand in the end I send a jms message. On the other hand I want
> an InOut pattern so my main will get back the result from
> "bean:myRMIClient1".
> 
> Can anyone advise how can this be achieved?
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-InOut-with-JMs-tp26965017p26965755.html
Sent from the Camel - Users mailing list archive at Nabble.com.