Class DiscoveryClientRoundRobinLoadBalancer

  • All Implemented Interfaces:
    LoadBalancer

    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)

    Since:
    1.0
    • Constructor Detail

      • DiscoveryClientRoundRobinLoadBalancer

        public DiscoveryClientRoundRobinLoadBalancer​(java.lang.String serviceID,
                                                     io.micronaut.discovery.DiscoveryClient discoveryClient)
        Parameters:
        serviceID - The service ID
        discoveryClient - The discovery client
    • Method Detail

      • select

        public org.reactivestreams.Publisher<io.micronaut.discovery.ServiceInstance> select​(java.lang.Object discriminator)
        Parameters:
        discriminator - An object used to discriminate the server to select. Usually the service ID
        Returns:
        The selected ServiceInstance