As suggested, I tried this with exchange pattern as inout. I think there are 2 issues. 1. it is not continuing with reply immediately, it waits till it receives a response. is this how it supposed to work in async mode?.I would think that like we had in deprecated toasync feature, it sends the async response to a new route to process messages received asynchronously. from("file:///test/test/response") .convertBodyTo(String.class) .threads(1) .to(ExchangePattern.InOut,"netty:tcp://localhost:6205?textline=true&sync=true") .to("log:+++ reply++++"); 2. it throws this exception even though it receives the response. Detailed stack trace is in the first post. 2010-08-19 16:40:38,663 [ Hashed wheel timer #1] DefaultErrorHandler DEBUG Failed delivery for exchangeId: afa68733-6228-4da2-b831-5a56ee39db51. On delivery attempt: 0 caught: org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 30000 millis. Exchange[GenericFileMessage with body: Bye 1hello1]
-----Original Message----- From: Claus Ibsen [mailto:claus.ib...@gmail.com] Sent: Thursday, August 19, 2010 11:06 AM To: users@camel.apache.org Subject: Re: netty issue On Thu, Aug 19, 2010 at 4:45 PM, Sadanand Kusma <sku...@arccorp.com> wrote: > Thanks for the response, if you set sync=true doesn't it make a synchronous > call. > Are you saying that it always runs in a async mode?,how do we tell it to run > in an async mode?. > Well the sync option is badly named, now the async non blocking routing engine is in place. Its kinda still there for compatibility. So view the sync as request/reply (InOut) What you need to ensure is the MEP is InOut. And sync=true is like saying InOut. The async routing ensures the thread is not blocked while waiting for the reply to come back from the TCP server. We should maybe @deprecate sync option and let it check the MEP of the Exchange. > -----Original Message----- > From: Willem Jiang [mailto:willem.ji...@gmail.com] > Sent: Wednesday, August 18, 2010 10:43 PM > To: users@camel.apache.org > Subject: Re: netty issue > > I just checked the netty's doc and camel-netty producer's code, if you > set the sync=false, the producer will never expect the response, and the > async callback will never be called. > > So you just need to change your route like this > > from("file:///test/test/response") > .convertBodyTo(String.class) > .threads(1) > .to("netty:tcp://localhost:6205?textline=true&sync=true") > .to("log:+++ reply++++"); > > > Willem > > Sadanand Kusma wrote: >> I am actually trying out asynchronous messaging with Netty producer. I get >> below exception even though sync =false. Also, Is this the right way to >> implement asynchronous processing. >> Here is my route: >> >> from("netty:tcp://localhost:6205?textline=true&sync=true").process(new >> Processor() { >> int i=0; >> public void process(Exchange exchange) throws Exception { >> String body = exchange.getIn().getBody(String.class); >> Thread.sleep(2000); >> exchange.getOut().setBody("Bye 1" + body); >> } >> }); >> >> from("file:///test/test/response") >> .convertBodyTo(String.class) >> .threads(1) >> .to("netty:tcp://localhost:6205?textline=true&sync=false") >> .to("log:+++ reply++++"); >> >> >> org.apache.camel.ExchangeTimedOutException: The OUT message was not received >> within: 30000 millis. Exchange[GenericFileMessage with body: Bye 1hello2] >> at >> org.apache.camel.component.netty.handlers.ClientChannelHandler.exceptionCaught(ClientChannelHandler.java:79) >> at >> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:122) >> at >> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) >> at >> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754) >> at >> org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:66) >> at >> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) >> at >> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754) >> at >> org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:238) >> at >> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:122) >> at >> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) >> at >> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754) >> at >> org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:443) >> at >> org.jboss.netty.handler.timeout.ReadTimeoutHandler.readTimedOut(ReadTimeoutHandler.java:210) >> at >> org.jboss.netty.handler.timeout.ReadTimeoutHandler$ReadTimeoutTask.run(ReadTimeoutHandler.java:237) >> at >> org.jboss.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:504) >> at >> org.jboss.netty.util.HashedWheelTimer$Worker.notifyExpiredTimeouts(HashedWheelTimer.java:419) >> at >> org.jboss.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:369) >> at >> org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) >> at java.lang.Thread.run(Thread.java:595) >> >> > > -- 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