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 LoadBalancer<C> |
newLoadBalancer(Publisher<? extends Collection<? extends ServiceDiscovererEvent<ResolvedAddress>>> eventPublisher,
ConnectionFactory<ResolvedAddress,C> connectionFactory,
String targetResource)
Create a new
LoadBalancer. |
default <T extends C> |
newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher,
ConnectionFactory<ResolvedAddress,T> connectionFactory)
Deprecated.
|
<T extends C> |
newLoadBalancer(String targetResource,
Publisher<? extends Collection<? extends ServiceDiscovererEvent<ResolvedAddress>>> eventPublisher,
ConnectionFactory<ResolvedAddress,T> connectionFactory)
Deprecated.
|
default ExecutionStrategy |
requiredOffloads() |
@Deprecated default <T extends C> LoadBalancer<T> newLoadBalancer(Publisher<? extends ServiceDiscovererEvent<ResolvedAddress>> eventPublisher, ConnectionFactory<ResolvedAddress,T> connectionFactory)
newLoadBalancer(Publisher, ConnectionFactory, String).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.@Deprecated <T extends C> LoadBalancer<T> newLoadBalancer(String targetResource, Publisher<? extends Collection<? extends ServiceDiscovererEvent<ResolvedAddress>>> eventPublisher, ConnectionFactory<ResolvedAddress,T> connectionFactory)
newLoadBalancer(Publisher, ConnectionFactory, String).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 LoadBalancer<C> newLoadBalancer(Publisher<? extends Collection<? extends ServiceDiscovererEvent<ResolvedAddress>>> eventPublisher, ConnectionFactory<ResolvedAddress,C> connectionFactory, String targetResource)
LoadBalancer.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.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 collection of hosts provided
via the eventPublisher which may not correspond directly to a single unresolved address, but potentially
a merged collection.LoadBalancer.default ExecutionStrategy requiredOffloads()
requiredOffloads in interface ExecutionStrategyInfluencer<ExecutionStrategy>