camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: How to use request reply in JMS
Date Tue, 21 Aug 2012 10:21:01 GMT
Hi

Just configure the name of the reply queue on the from uri. You may
want to configure the reply queue as being exclusive then it runs
faster. Then when the route completes, the message will be send back
to the reply queue. eg in the example below, after the processor has
run, the message containing "Hello World" will be send back to the
OUTPUT.Q.

from("activemq://queue:INPUT.Q?jmsMessageType=Object&replyTo=OUTPUT.Q&replyToType=Exclusive")
.process(new
 Processor() {
           @Override
           public void process(Exchange exchange) throws Exception {
             exchange.getOut().setBody("Hello World");
           }
         });

I suggest to read the JMS page. It has sections about request/reply
etc, and some pointers how and what to look out for. And what to
configure etc.
http://camel.apache.org/jms

And mind that you can use 3 kind of queues when doing request/reply
- temporary queue
- shared queue
- exclusive queue

So mind the difference.



On Tue, Aug 21, 2012 at 11:31 AM, agustino <siau_ti3@yahoo.com> wrote:
> Hi All,
>
> Is there any example for request reply in JMS? Currently I am using camel
> 2.10
> from("activemq://queue:INPUT.Q?jmsMessageType=Object")
>         .setExchangePattern(ExchangePattern.InOut).
>
> .to("activemq://queue:OUTPUT.Q?jmsMessageType=Object&replyTo=REPLY.Q").process(new
> Processor() {
>
>           @Override
>           public void process(Exchange exchange) throws Exception {
>             exchange.getOut().setBody("Hello World");
>           }
>         });
>
> I get this error:
> The OUT message was not received within: 20000 millis due reply message with
> correlationID: ID-JCSS047-63163-1345541374562-0-2 not received.
> Exchange[JmsMessage[JmsMessageID: ID:JCSS047-63159-1345541364315-0:2:1:1:1]]
>         at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1221)
>         at
> org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:187)
>         at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:108)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-use-request-reply-in-JMS-tp5717752.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message