public interface AsyncLoadBalancingHandler
AsyncLoadBalancingHandler is the runtime component of a LoadBalancingStrategy that provides the
logic for load balancing requests to TargetHosts configured for a Site. Different from a
LoadBalancingHandler, a AsyncLoadBalancingHandler applies this logic asynchronously.LoadBalancingHandler| Modifier and Type | Method and Description |
|---|---|
CompletionStage<TargetHost> |
calculateTargetHost(Exchange exchange,
List<TargetHost> availableHosts,
List<TargetHost> configuredHosts)
Calculate the target host, given the list of available hosts and the current exchange.
|
CompletionStage<Void> |
handleResponse(Exchange exchange,
TargetHost targetHost)
Updates any internal data based on the response and optionally updates the response.
|
CompletionStage<TargetHost> calculateTargetHost(Exchange exchange, List<TargetHost> availableHosts, List<TargetHost> configuredHosts)
TargetHost is detected as unavailable after it is
selected. To store data in between invocations, use the Exchange.setProperty(ExchangeProperty, Object)
method.exchange - The exchange.availableHosts - The list of available hosts for a Site. This list cannot be modified by implementations.configuredHosts - The list of configured hosts for a Site. This can be used to determine which hosts for the
Site are available and perform any necessary cleanup for this case. This list cannot be
modified by implementations.CompletionStage containing the target host or null if none could be determined. The behavior
is undefined when the TargetHost returned is not an element of the availableHosts list.CompletionStage<Void> handleResponse(Exchange exchange, TargetHost targetHost)
exchange - The exchange containing the response.targetHost - The target host used for the request.CompletionStage representing the asynchronous completion of the method. If this method does
not require use of a HttpClient, the logic of the method can be performed synchronously and
then return a completed CompletionStage with code like:
CompletableFuture.completedFuture(null)
Copyright 2023 Ping Identity Corp. All rights reserved.