Adding servers in the client-side dynamically/Runtime

1.1k views Asked by At

I am using Consul for Service Discovery; and supply list of servers in NameResolver.start(Listener listener) during Client startup.

  1. How can i add new Servers that Joined-in as Service Providers (in Consul)
  2. I am using Round Robin; and when one of the server dies; it keeps hitting the dead server
  3. Would you have a sample to retry on UNAVAILABLE exception? I just want to retry atleast once before giving up on the Client side.

Thank you in Advance

3

There are 3 answers

0
sid On

I wrote my own LoadBalancer; and @Override pickTransport() to RoundRobin healthy gRPC servers from Consul.

5
Eric Anderson On

When the list of servers change (in Consul), call NameResolver.Listener.onUpdate(), which you should be calling at least once already.

The load balancing implementations and APIs are receiving a massive rework, which should greatly improve round robin.

0
wthamira On

In here I use consul as my registry. It works correctly.

It contain both example of Eureka and consul.

https://github.com/WThamira/gRpc-spring-boot-example