public class RibbonLoadBalancerClient extends Object implements org.springframework.cloud.client.loadbalancer.LoadBalancerClient
Modifier and Type | Class and Description |
---|---|
static class |
RibbonLoadBalancerClient.RibbonServer
Ribbon-server-specific
ServiceInstance implementation. |
Constructor and Description |
---|
RibbonLoadBalancerClient(SpringClientFactory clientFactory) |
Modifier and Type | Method and Description |
---|---|
org.springframework.cloud.client.ServiceInstance |
choose(String serviceId) |
org.springframework.cloud.client.ServiceInstance |
choose(String serviceId,
Object hint)
New: Select a server using a 'key'.
|
<T> T |
execute(String serviceId,
org.springframework.cloud.client.loadbalancer.LoadBalancerRequest<T> request) |
<T> T |
execute(String serviceId,
org.springframework.cloud.client.loadbalancer.LoadBalancerRequest<T> request,
Object hint)
New: Execute a request by selecting server using a 'key'.
|
<T> T |
execute(String serviceId,
org.springframework.cloud.client.ServiceInstance serviceInstance,
org.springframework.cloud.client.loadbalancer.LoadBalancerRequest<T> request) |
protected com.netflix.loadbalancer.ILoadBalancer |
getLoadBalancer(String serviceId) |
protected com.netflix.loadbalancer.Server |
getServer(com.netflix.loadbalancer.ILoadBalancer loadBalancer) |
protected com.netflix.loadbalancer.Server |
getServer(com.netflix.loadbalancer.ILoadBalancer loadBalancer,
Object hint) |
protected com.netflix.loadbalancer.Server |
getServer(String serviceId) |
URI |
reconstructURI(org.springframework.cloud.client.ServiceInstance instance,
URI original) |
public RibbonLoadBalancerClient(SpringClientFactory clientFactory)
public URI reconstructURI(org.springframework.cloud.client.ServiceInstance instance, URI original)
reconstructURI
in interface org.springframework.cloud.client.loadbalancer.LoadBalancerClient
public org.springframework.cloud.client.ServiceInstance choose(String serviceId)
choose
in interface org.springframework.cloud.client.loadbalancer.ServiceInstanceChooser
public org.springframework.cloud.client.ServiceInstance choose(String serviceId, Object hint)
serviceId
- of the service to choose an instance forhint
- to specify the service instanceServiceInstance
public <T> T execute(String serviceId, org.springframework.cloud.client.loadbalancer.LoadBalancerRequest<T> request) throws IOException
execute
in interface org.springframework.cloud.client.loadbalancer.LoadBalancerClient
IOException
public <T> T execute(String serviceId, org.springframework.cloud.client.loadbalancer.LoadBalancerRequest<T> request, Object hint) throws IOException
T
- returned request execution result typeserviceId
- id of the service to execute the request torequest
- to be executedhint
- used to choose appropriate Server
instanceIOException
- executing the request may result in an IOException
public <T> T execute(String serviceId, org.springframework.cloud.client.ServiceInstance serviceInstance, org.springframework.cloud.client.loadbalancer.LoadBalancerRequest<T> request) throws IOException
execute
in interface org.springframework.cloud.client.loadbalancer.LoadBalancerClient
IOException
protected com.netflix.loadbalancer.Server getServer(String serviceId)
protected com.netflix.loadbalancer.Server getServer(com.netflix.loadbalancer.ILoadBalancer loadBalancer)
protected com.netflix.loadbalancer.Server getServer(com.netflix.loadbalancer.ILoadBalancer loadBalancer, Object hint)
protected com.netflix.loadbalancer.ILoadBalancer getLoadBalancer(String serviceId)
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.