Package io.micronaut.http.client
Interface LoadBalancer
-
- All Known Implementing Classes:
AbstractRoundRobinLoadBalancer,DiscoveryClientRoundRobinLoadBalancer,FixedLoadBalancer,ServiceInstanceListRoundRobinLoadBalancer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface LoadBalancerInterface to abstract server selection. Allows plugging in load balancing strategies.- Since:
- 1.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static LoadBalancerempty()static LoadBalancerfixed(java.net.URI uri)ALoadBalancerthat does no load balancing and always hits the given URI.static LoadBalancerfixed(java.net.URL url)Deprecated.Usefixed(URI)insteaddefault java.util.Optional<java.lang.String>getContextPath()default org.reactivestreams.Publisher<io.micronaut.discovery.ServiceInstance>select()org.reactivestreams.Publisher<io.micronaut.discovery.ServiceInstance>select(java.lang.Object discriminator)
-
-
-
Method Detail
-
select
org.reactivestreams.Publisher<io.micronaut.discovery.ServiceInstance> select(@Nullable java.lang.Object discriminator)- Parameters:
discriminator- An object used to discriminate the server to select. Usually the service ID- Returns:
- The selected
ServiceInstance
-
getContextPath
default java.util.Optional<java.lang.String> getContextPath()
- Returns:
- The context path to use for requests.
-
select
default org.reactivestreams.Publisher<io.micronaut.discovery.ServiceInstance> select()
- Returns:
- The selected
ServiceInstance
-
fixed
@Deprecated static LoadBalancer fixed(java.net.URL url)
Deprecated.Usefixed(URI)insteadALoadBalancerthat does no load balancing and always hits the given URL.- Parameters:
url- The URL- Returns:
- The
LoadBalancer
-
fixed
static LoadBalancer fixed(java.net.URI uri)
ALoadBalancerthat does no load balancing and always hits the given URI.- Parameters:
uri- The URI- Returns:
- The
LoadBalancer
-
empty
static LoadBalancer empty()
- Returns:
- An error because there are no load balancer
-
-