ResolvedAddress - The type of address after resolution.C - The type of connection.@FunctionalInterface
public interface LoadBalancerFactory<ResolvedAddress,C extends LoadBalancedConnection>
extends ExecutionStrategyInfluencer<ExecutionStrategy>
LoadBalancer instances.| Modifier and Type | Method and Description |
|---|---|
default <T extends C> |
newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
ConnectionFactory<ResolvedAddress,T> connectionFactory)
Deprecated.
In the future only
newLoadBalancer(String, Publisher, ConnectionFactory) will remain,
please use that method instead. |
<T extends C> |
newLoadBalancer(String targetResource,
Publisher<? extends Collection<? extends ServiceDiscovererEvent<ResolvedAddress>>> eventPublisher,
ConnectionFactory<ResolvedAddress,T> connectionFactory)
Create a new
LoadBalancer. |
default ExecutionStrategy |
requiredOffloads() |
@Deprecated default <T extends C> LoadBalancer<T> newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> connectionFactory)
newLoadBalancer(String, Publisher, ConnectionFactory) will remain,
please use that method instead.LoadBalancer.T - Type of connections created by the passed ConnectionFactory.eventPublisher - A stream of ServiceDiscovererEvents which the LoadBalancer can use to
connect to physical hosts. Typically generated from a
ServiceDiscoverer.connectionFactory - ConnectionFactory that the returned LoadBalancer will use to generate
new connections. Returned LoadBalancer will own the responsibility for this ConnectionFactory
and hence will call AsyncCloseable.closeAsync() when AsyncCloseable.closeAsync() is called.LoadBalancer.<T extends C> LoadBalancer<T> newLoadBalancer(String targetResource, Publisher<? extends Collection<? extends ServiceDiscovererEvent<ResolvedAddress>>> eventPublisher, ConnectionFactory<ResolvedAddress,T> connectionFactory)
LoadBalancer.T - Type of connections created by the passed ConnectionFactory.targetResource - A String representation of the target resource for which the created instance
will perform load balancing. Bear in mind, load balancing is performed over the a collection of hosts provided
via the eventPublisher which may not correspond directly to a single unresolved address, but potentially
a merged collection.eventPublisher - A stream of Collection<ServiceDiscovererEvent>
which the LoadBalancer can use to connect to physical hosts. Typically generated
from ServiceDiscoverer.connectionFactory - ConnectionFactory that the returned LoadBalancer will use to generate
new connections. Returned LoadBalancer will own the responsibility for this ConnectionFactory
and hence will call AsyncCloseable.closeAsync() when AsyncCloseable.closeAsync() is called.LoadBalancer.default ExecutionStrategy requiredOffloads()
requiredOffloads in interface ExecutionStrategyInfluencer<ExecutionStrategy>