Package io.micronaut.http.client
Class DefaultLoadBalancerResolver
java.lang.Object
io.micronaut.http.client.DefaultLoadBalancerResolver
- All Implemented Interfaces:
LoadBalancerResolver
Abstraction over LoadBalancer
lookup. The strategy is as follows:
- If a reference starts with '/' then we attempt to look up the
EmbeddedServer
- If the reference contains a '/' assume it is a URL and try to create a URL reference to it
- Otherwise delegate to the
DiscoveryClient
to attempt to resolve the URIs
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
ConstructorDescriptionDefaultLoadBalancerResolver
(BeanContext beanContext, ServiceInstanceList... serviceInstanceLists) The default server loadbalance resolver.DefaultLoadBalancerResolver
(BeanContext beanContext, List<ServiceInstanceList> serviceInstanceLists) The default server loadbalance resolver. -
Method Summary
Modifier and TypeMethodDescriptionOptional<? extends LoadBalancer>
Resolve aLoadBalancer
for the given references.protected Optional<? extends LoadBalancer>
resolveLoadBalancerForServiceID
(String serviceID)
-
Constructor Details
-
DefaultLoadBalancerResolver
public DefaultLoadBalancerResolver(BeanContext beanContext, ServiceInstanceList... serviceInstanceLists) The default server loadbalance resolver.- Parameters:
beanContext
- The bean contextserviceInstanceLists
- Any other providers
-
DefaultLoadBalancerResolver
@Inject public DefaultLoadBalancerResolver(BeanContext beanContext, List<ServiceInstanceList> serviceInstanceLists) The default server loadbalance resolver.- Parameters:
beanContext
- The bean contextserviceInstanceLists
- Any other providers
-
-
Method Details
-
resolve
Description copied from interface:LoadBalancerResolver
Resolve aLoadBalancer
for the given references.- Specified by:
resolve
in interfaceLoadBalancerResolver
- Parameters:
serviceReferences
- The references. These could be service IDs or fully HTTP URLs- Returns:
- A
LoadBalancer
or empty of non can be resolved
-
resolveLoadBalancerForServiceID
- Parameters:
serviceID
- The service ID- Returns:
- An
Optional
with the load balancer
-