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: Recovery From Netty Connection Drop
Date Thu, 06 May 2010 04:33:16 GMT
Hi

Well spotted. Can you create a JIRA ticket ticket for that.


On Thu, May 6, 2010 at 6:29 AM, Gareth Collins
<gareth_collins@hotmail.com> wrote:
>
> 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.
>
>



-- 
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

Mime
View raw message