public class DiscoveryClientRoundRobinLoadBalancer extends AbstractRoundRobinLoadBalancer
A LoadBalancer
that uses the DiscoveryClient
and a
ServiceInstance
ID to automatically load balance between discovered clients in a non-blocking manner.
Note that the when DiscoveryClient
caching is enabled then this load balancer may not always have the
latest server list from the DiscoveryClient
(the default TTL is 30 seconds)
index
Constructor and Description |
---|
DiscoveryClientRoundRobinLoadBalancer(String serviceID,
DiscoveryClient discoveryClient) |
Modifier and Type | Method and Description |
---|---|
String |
getServiceID() |
Publisher<ServiceInstance> |
select(Object discriminator) |
getNextAvailable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
empty, fixed, select
public DiscoveryClientRoundRobinLoadBalancer(String serviceID, DiscoveryClient discoveryClient)
serviceID
- The service IDdiscoveryClient
- The discovery clientpublic String getServiceID()
getServiceID
in class AbstractRoundRobinLoadBalancer
public Publisher<ServiceInstance> select(Object discriminator)
discriminator
- An object used to discriminate the server to select. Usually the service IDServiceInstance