camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: netty issue
Date Thu, 19 Aug 2010 02:43:07 GMT
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)
> 
> 


Mime
View raw message