Module io.inverno.mod.discovery
Package io.inverno.mod.discovery
Interface TrafficPolicy<A extends ServiceInstance,B>
- Type Parameters:
A
- the type of service instanceB
- the type of service request
- All Known Implementing Classes:
HttpTrafficPolicy
public interface TrafficPolicy<A extends ServiceInstance,B>
A traffic specifies the configuration and load balancing strategy used by a service to create its list of ServiceInstance
and load balance service request among them.
A traffic policy is used in conjunction with a ServiceID
in order to uniquely identify a resolved service such as in a CachingDiscoveryService
, implementations must then implement
Object.equals(Object)
and Object.hashCode()
.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptiongetLoadBalancer
(Collection<A> instances) Returns a traffic load balancer for load balancing service request among the specified collection of instances.
-
Method Details
-
getLoadBalancer
Returns a traffic load balancer for load balancing service request among the specified collection of instances.
- Parameters:
instances
- a collection of service instances- Returns:
- a traffic load balancer
- Throws:
IllegalArgumentException
- if the collection of instance is empty
-