java.lang.Object
io.inverno.mod.discovery.http.HttpTrafficPolicy
- All Implemented Interfaces:
TrafficPolicy<HttpServiceInstance,UnboundExchange<?>>
public class HttpTrafficPolicy
extends Object
implements TrafficPolicy<HttpServiceInstance,UnboundExchange<?>>
An HTTP traffic policy defining load balancing strategy as well as configuration HTTP client and Net client configurations used when creating an HTTP client
Endpoint in a service instance.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn HTTP traffic policy builder.static enumLoad balancing strategies supported in HTTP services. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpTrafficPolicy.LoadBalancingStrategyThe default load balancer strategy. -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpTrafficPolicy.Builderbuilder()Returns an HTTP traffic policy builder.static HttpTrafficPolicy.Builderbuilder(HttpTrafficPolicy originalTrafficPolicy) Returns an HTTP traffic policy builder from an original traffic policy.booleanReturns the HTTP client configuration.getLoadBalancer(Collection<HttpServiceInstance> instances) Returns a traffic load balancer for load balancing service request among the specified collection of instances.Returns the load balancer factory.Returns the load balancing strategy.Returns the Net client configuration.inthashCode()
-
Field Details
-
DEFAULT_LOAD_BALANCER_STRATEGY
The default load balancer strategy.
-
-
Method Details
-
getConfiguration
Returns the HTTP client configuration.
- Returns:
- the HTTP client configuration or null to use the default configuration
-
getNetConfiguration
Returns the Net client configuration.
- Returns:
- the Net client configuration or null to use the default configuration
-
getLoadBalancerFactory
Returns the load balancer factory.
- Returns:
- the load balancer factory
-
getLoadBalancingStrategy
Returns the load balancing strategy.
- Returns:
- the load balancing strategy
-
builder
Returns an HTTP traffic policy builder.
- Returns:
- an HTTP traffic policy builder
-
builder
Returns an HTTP traffic policy builder from an original traffic policy.
- Parameters:
originalTrafficPolicy- the original traffic policy- Returns:
- an HTTP traffic policy builder
-
getLoadBalancer
public TrafficLoadBalancer<HttpServiceInstance,UnboundExchange<?>> getLoadBalancer(Collection<HttpServiceInstance> instances) throws IllegalArgumentException Description copied from interface:TrafficPolicyReturns a traffic load balancer for load balancing service request among the specified collection of instances.
- Specified by:
getLoadBalancerin interfaceTrafficPolicy<HttpServiceInstance,UnboundExchange<?>> - Parameters:
instances- a collection of service instances- Returns:
- a traffic load balancer
- Throws:
IllegalArgumentException- if the collection of instance is empty
-
equals
-
hashCode
public int hashCode()
-