问题
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..
来源:https://stackoverflow.com/questions/8725228/netty-high-availability-cluster