Netty High Availability Cluster

别来无恙 提交于 2019-12-06 10:20:59

If you want to make the client and server highly available and to manage the connections state by your code with ease, Have a look on Akka Remote Actor API which is using Netty for underlying communication .

There is no example of this. But I think its quite straight-forward. You need to have a pool of different "channels" that are connected to remote hosts. The do something like this:

channel.write(msg).addListener() {
    public void operationComplete(ChannelFuture future) {
        if (!future.isSuccess) {
            ... // get next channel from the pool and try the write there etc..
        }
    }
}

Hope it helps..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!