Class DiscoveryClientRoundRobinLoadBalancer
java.lang.Object
io.micronaut.http.client.loadbalance.AbstractRoundRobinLoadBalancer
io.micronaut.http.client.loadbalance.DiscoveryClientRoundRobinLoadBalancer
- All Implemented Interfaces:
LoadBalancer
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)
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from class io.micronaut.http.client.loadbalance.AbstractRoundRobinLoadBalancer
index
-
Constructor Summary
ConstructorDescriptionDiscoveryClientRoundRobinLoadBalancer
(String serviceID, DiscoveryClient discoveryClient) -
Method Summary
Modifier and TypeMethodDescriptionMethods inherited from class io.micronaut.http.client.loadbalance.AbstractRoundRobinLoadBalancer
getNextAvailable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.client.LoadBalancer
getContextPath, select
-
Constructor Details
-
DiscoveryClientRoundRobinLoadBalancer
- Parameters:
serviceID
- The service IDdiscoveryClient
- The discovery client
-
-
Method Details
-
getServiceID
- Specified by:
getServiceID
in classAbstractRoundRobinLoadBalancer
- Returns:
- The service ID
-
select
- Parameters:
discriminator
- An object used to discriminate the server to select. Usually the service ID- Returns:
- The selected
ServiceInstance
-