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(java.lang.String serviceID,
DiscoveryClient discoveryClient) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getServiceID() |
org.reactivestreams.Publisher<ServiceInstance> |
select(java.lang.Object discriminator) |
getNextAvailable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
empty, fixed, getContextPath, select
public DiscoveryClientRoundRobinLoadBalancer(java.lang.String serviceID, DiscoveryClient discoveryClient)
serviceID
- The service IDdiscoveryClient
- The discovery clientpublic java.lang.String getServiceID()
getServiceID
in class AbstractRoundRobinLoadBalancer
public org.reactivestreams.Publisher<ServiceInstance> select(java.lang.Object discriminator)
discriminator
- An object used to discriminate the server to select. Usually the service IDServiceInstance