Hello,

I took a look at the Netty Producer code:

    public void process(Exchange exchange) throws Exception {
        if (configuration.isSync()) {
            countdownLatch = new CountDownLatch(1);
        }
        
        Channel channel = channelFuture.getChannel();
        channel.write(exchange.getIn().getBody());
        
        if (configuration.isSync()) {
            boolean success =
countdownLatch.await(configuration.getReceiveTimeoutMillis(),
TimeUnit.MILLISECONDS);
            if (!success) {
                throw new ExchangeTimedOutException(exchange,
configuration.getReceiveTimeoutMillis());
            }
            Object response = ((ClientChannelHandler)
clientPipeline.get("handler")).getResponse();
            exchange.getOut().setBody(response);
        }                 
    }

After taking a look at the netty documentation, I don't see how this will
detect write failures (as I understand the channel.write() is asynchronous).
Don't we need to wait on the ChannelFuture returned from the
channel.write()? (i.e.

Channel channel = channelFuture.getChannel();
ChannelFuture channelWriteFuture =
channel.write(exchange.getIn().getBody());
channelWriteFuture.awaitUninterruptibly()
if (channelWriteFuture.isSuccess() == false)
{
    // throw some exception
    // or possibly if connection closed, try to create connection and send
again
    // if fails again throw exception
}

thanks in advance,
Gareth Collins


-- 
View this message in context: 
http://old.nabble.com/Recovery-From-Netty-Connection-Drop-tp28467631p28469185.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to