Hi Tung,
Try removing the <to uri="{{jms.queue.test.reply}}" /> from your route.
Normally, for InOut, you should not send the response back explicitly. Camel
takes care of that for you. :)
Good luck.
Mathieu
----------------------------------------
> Date: Mon, 24 Oct 2011 18:21:02 +0200
> Subject: JMS request-reply and transactions
> From: [email protected]
> To: [email protected]
>
> Hello,
>
> I want to setup 2 separate routes in my camel context to create a
> synchronous spring bean method, which triggers a JMS based request-reply
> service.
>
> The front (synchronous) bean is invoked via a simple Spring web MVC
> controller, and dumps the response back to the browser. The second route, in
> a separate transaction, pulls the message from the request queue, performs a
> simple transformation and puts the response back into (shared) response
> queue (both queues from external IBM MQ server).
>
> At first, things were looking fine, because my browser page renders the
> response as expected. But in a second look, I discovered that the log still
> mentions a timeout (default 20 secs) waiting for the reply, although the
> reply has been received already! And secondly, after the timeout, the
> response message (re-) occurs on the response queue, and remains there.
>
> I assume the reply handler is missing some transaction commit, causing some
> automatic rollback, so the reply bounces back to the reply queue. Is that
> correct?
>
> How should/can I avoid this? I have read something about the
> "transactedInOut" option, but it is currently deprecated, and setting it on
> the request queue doesn't seem to help.
>
> This is the proxy and surrounding request-reply route:
>
> <bean id="testHelloProxy"
> class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
> <property name="serviceUrl" value="direct:testHello"/>
> <property name="serviceInterface"
> value="com.mazdaeur.mgws.service.TestService"/>
> </bean>
>
> <camel:route id="testHello" autoStartup="true">
> <from uri="direct:testHello" />
> <camel:inOut uri="{{jms.queue.test.request}}"/>
> </camel:route>
>
> And the dummy echo service on the other side:
>
> <route id="testEcho" autoStartup="true">
> <from uri="{{jms.queue.test.request}}" />
> <camel:transacted />
> <transform>
> <simple>Hello ${body} (id ${id}) </simple>
> </transform>
> <setHeader headerName="JMSCorrelationID">
> <simple>${in.header.JMSMessageID}</simple>
> </setHeader>
> <to uri="{{jms.queue.test.reply}}" />
> </route>
>
> Last, the 2 external IBM MQ queues referred by JNDI, including some camel
> options:
>
> jms.queue.test.request=jms:queue:jms/queue.mud_rt_snd.01?replyTo=jms/queue.mud_rt_rec.01&useMessageIDAsCorrelationID=true&jmsMessageType=Text&messageConverter=#simpleBeanInvocationConverter&transactedInOut=true
>
> jms.queue.test.reply=jms:queue:jms/queue.mud_rt_rec.01
>
>
> Running on camel-2.6.0, inside IBM WebSphere 6.1 and IBM MQ, most resources
> referred by JNDI.
>
>
> Any help pointing me into the good direction is greatly appreciated!
>
> Thanks,
>
> Tung