You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mark Webb <el...@gmail.com> on 2010/08/11 20:45:33 UTC
request / response example
I am trying to figure out how to set up a request / response in Camel
with ActiveMQ. Basically this is what I am looking for:
myapp -> queue.A -> processor(DB query) -> queue.A -> myapp
I have read through the documentation and the closest I have come is
the following sping-camel example:
<route>
<from uri="jms:queue.A" />
<process ref="processor" />
<to uri="jms:queue.A" pattern="InOut" />
</route>
This seems to work, but it doesn't seem right to me that I need a
"from" and "to". Plus I get a
org.apache.camel.ExchangeTimedOutException: exception on each message.
Thanks for any help you have,
Mark
Re: request / response example
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Aug 12, 2010 at 4:33 PM, Mark Webb <el...@gmail.com> wrote:
> OK, cool. I got that to work. Now what about the case in which I do
> not want to set the JMSReplyTo header field? How would that work?
>
Thats the event message EIP pattern
http://camel.apache.org/event-message.html
> Thanks for the help
>
>
>
> On Wed, Aug 11, 2010 at 4:51 PM, Claus Ibsen <cl...@gmail.com> wrote:
>> If the JMS message has a JMSReplyTo header then the JMS consumer will
>> use request/reply automatically.
>> http://camel.apache.org/request-reply.html
>>
>> So you route should simply just be:
>>
>> <route>
>> <from uri="jms:queue.A" />
>> <process ref="processor" />
>> </route>
>>
>> So when the route ends, the consumer jms:queue.A will send the reply
>> back the the queue defined in the JMSReplyTo header.
>>
>>
>> On Wed, Aug 11, 2010 at 8:45 PM, Mark Webb <el...@gmail.com> wrote:
>>> I am trying to figure out how to set up a request / response in Camel
>>> with ActiveMQ. Basically this is what I am looking for:
>>>
>>>
>>> myapp -> queue.A -> processor(DB query) -> queue.A -> myapp
>>>
>>>
>>> I have read through the documentation and the closest I have come is
>>> the following sping-camel example:
>>>
>>> <route>
>>> <from uri="jms:queue.A" />
>>> <process ref="processor" />
>>> <to uri="jms:queue.A" pattern="InOut" />
>>> </route>
>>>
>>> This seems to work, but it doesn't seem right to me that I need a
>>> "from" and "to". Plus I get a
>>> org.apache.camel.ExchangeTimedOutException: exception on each message.
>>>
>>>
>>> Thanks for any help you have,
>>> Mark
>>>
>>
>>
>>
>> --
>> 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
>>
>
--
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
AW: request / response example
Posted by Schneider Christian <Ch...@enbw.com>.
Hi Mark,
you don´t have to set the header by hand. If you use a route for the client then Camel will automatically create a temporary reply queue, set the header field and listen for the response.
The code below would allow you to send requests to the direct endpoint that travel to the jms queue and to the processor and back again to your direct endpoint.
<route>
<from uri="direct:myEndpoint" />
<to uri="jms:queue.A" />
</route>
<route>
<from uri="jms:queue.A" />
<process ref="processor" />
</route>
Using the reply to header is the standard jsm way to do request response. Is there any special reason why you want to do this in another way?
Greetings
Christian
Christian Schneider
Informationsverarbeitung
Business Solutions
Handel und Dispatching
Tel : +49-(0)721-63-15482
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
-----Ursprüngliche Nachricht-----
Von: Mark Webb [mailto:elihusmails@gmail.com]
Gesendet: Donnerstag, 12. August 2010 16:33
An: users@camel.apache.org
Betreff: Re: request / response example
OK, cool. I got that to work. Now what about the case in which I do
not want to set the JMSReplyTo header field? How would that work?
Thanks for the help
On Wed, Aug 11, 2010 at 4:51 PM, Claus Ibsen <cl...@gmail.com> wrote:
> If the JMS message has a JMSReplyTo header then the JMS consumer will
> use request/reply automatically.
> http://camel.apache.org/request-reply.html
>
> So you route should simply just be:
>
> <route>
> <from uri="jms:queue.A" />
> <process ref="processor" />
> </route>
>
> So when the route ends, the consumer jms:queue.A will send the reply
> back the the queue defined in the JMSReplyTo header.
>
>
> On Wed, Aug 11, 2010 at 8:45 PM, Mark Webb <el...@gmail.com> wrote:
>> I am trying to figure out how to set up a request / response in Camel
>> with ActiveMQ. Basically this is what I am looking for:
>>
>>
>> myapp -> queue.A -> processor(DB query) -> queue.A -> myapp
>>
>>
>> I have read through the documentation and the closest I have come is
>> the following sping-camel example:
>>
>> <route>
>> <from uri="jms:queue.A" />
>> <process ref="processor" />
>> <to uri="jms:queue.A" pattern="InOut" />
>> </route>
>>
>> This seems to work, but it doesn't seem right to me that I need a
>> "from" and "to". Plus I get a
>> org.apache.camel.ExchangeTimedOutException: exception on each message.
>>
>>
>> Thanks for any help you have,
>> Mark
>>
>
>
>
> --
> 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: request / response example
Posted by Mark Webb <el...@gmail.com>.
OK, cool. I got that to work. Now what about the case in which I do
not want to set the JMSReplyTo header field? How would that work?
Thanks for the help
On Wed, Aug 11, 2010 at 4:51 PM, Claus Ibsen <cl...@gmail.com> wrote:
> If the JMS message has a JMSReplyTo header then the JMS consumer will
> use request/reply automatically.
> http://camel.apache.org/request-reply.html
>
> So you route should simply just be:
>
> <route>
> <from uri="jms:queue.A" />
> <process ref="processor" />
> </route>
>
> So when the route ends, the consumer jms:queue.A will send the reply
> back the the queue defined in the JMSReplyTo header.
>
>
> On Wed, Aug 11, 2010 at 8:45 PM, Mark Webb <el...@gmail.com> wrote:
>> I am trying to figure out how to set up a request / response in Camel
>> with ActiveMQ. Basically this is what I am looking for:
>>
>>
>> myapp -> queue.A -> processor(DB query) -> queue.A -> myapp
>>
>>
>> I have read through the documentation and the closest I have come is
>> the following sping-camel example:
>>
>> <route>
>> <from uri="jms:queue.A" />
>> <process ref="processor" />
>> <to uri="jms:queue.A" pattern="InOut" />
>> </route>
>>
>> This seems to work, but it doesn't seem right to me that I need a
>> "from" and "to". Plus I get a
>> org.apache.camel.ExchangeTimedOutException: exception on each message.
>>
>>
>> Thanks for any help you have,
>> Mark
>>
>
>
>
> --
> 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: request / response example
Posted by Claus Ibsen <cl...@gmail.com>.
If the JMS message has a JMSReplyTo header then the JMS consumer will
use request/reply automatically.
http://camel.apache.org/request-reply.html
So you route should simply just be:
<route>
<from uri="jms:queue.A" />
<process ref="processor" />
</route>
So when the route ends, the consumer jms:queue.A will send the reply
back the the queue defined in the JMSReplyTo header.
On Wed, Aug 11, 2010 at 8:45 PM, Mark Webb <el...@gmail.com> wrote:
> I am trying to figure out how to set up a request / response in Camel
> with ActiveMQ. Basically this is what I am looking for:
>
>
> myapp -> queue.A -> processor(DB query) -> queue.A -> myapp
>
>
> I have read through the documentation and the closest I have come is
> the following sping-camel example:
>
> <route>
> <from uri="jms:queue.A" />
> <process ref="processor" />
> <to uri="jms:queue.A" pattern="InOut" />
> </route>
>
> This seems to work, but it doesn't seem right to me that I need a
> "from" and "to". Plus I get a
> org.apache.camel.ExchangeTimedOutException: exception on each message.
>
>
> Thanks for any help you have,
> Mark
>
--
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