Netty client: handling disconnections
Christian Migowski
chrismfwrd at gmail.com
Fri Jun 25 01:51:19 EDT 2010
Hi Murali,
there are many different approaches to reconnect, Trustin provided a
very straight-forward one in the Netty examples, see:
http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/example/uptime/package-summary.html
hth,
regards,
christian!
On Fri, Jun 25, 2010 at 4:06 AM, Murali Mohan Rath <mmrath at gmail.com> wrote:
>
> Hi All,
> I searched the forum for what I am looking for could not get much
> information. Here is what I want to do.
>
> I have a client which can open a single connection to server(not Netty). On
> connect I am getting hold of the channel in a requester object as below
>
> @Override
> public void channelConnected(
> ChannelHandlerContext ctx, ChannelStateEvent e) {
>
> requester.setChannel(e.getChannel());
> try{
> requester.requestDatabaseStatus();
> }catch (IOException exception){
> logger.error("Error while requesting deal status",exception);
> }
> }
>
>
> The requester object is used from various places in the application to send
> request. Now my target is to handle the disconnections. Whenever there is a
> disconnection I want to retry connecting every 10 seconds and once connected
> the requester will be updated by the new channel.
>
> I am not sure which is the best place to detect such disconnection and what
> is the best approach to reconnect. Any information around this will be great
> help.
>
> FYI. a) I have a heartbeat handler to send a ping message if the connection
> is idle for few seconds. b) while connecting I am setting keepAlive to true;
>
>
> Thanks,
> Murali
>
>
>
> --
> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Netty-client-handling-disconnections-tp5220338p5220338.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
More information about the netty-users
mailing list