For now,we have a client side load balancer,maybe we need a failover strategy to deal with the request failed.I have some candidate proposals:
3)Catch the network exception when invoking,and select the next endpoint to continue the method request
The following code illustrates this point
public final class EndpointGroupInvoker extends DecoratingRemoteInvoker {
....
@Override
public <T> Future<T> invoke(EventLoop eventLoop, URI uri,
ClientOptions options,
ClientCodec codec, Method method,
Object[] args) throws Exception {
for(int time=0;time<tryCount;time++){
URI uri = selectedEndpoint();
try {
return delegate().invoke(eventLoop, uri, options, codec, method, args);
}catch (NetworkException ex){
//do some logging
}
}
}
}
Pros:can ensure the request success if the endpoint group has alive instance and the tryCount number is large enough.
Cons:the armeria is async,maybe catching the network exception in this way is not easy(need some sync test?) and has performance impact.