Wondering if Netty has any examples of how I can create a high availability application whereby the netty client will use a backup server in case of live server failure.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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 .
回答2:
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..