public final class ClientPeerRejectionPolicy
extends Object
TrafficResilienceHttpServiceFilter.| Modifier and Type | Field and Description |
|---|---|
static Predicate<HttpResponseMetaData> |
DEFAULT_CAPACITY_REJECTION_PREDICATE
Default rejection observer for dropped requests from an external sourced.
|
static ClientPeerRejectionPolicy |
DEFAULT_PEER_REJECTION_POLICY
Default rejection policy for peer responses.
|
| Modifier and Type | Method and Description |
|---|---|
static ClientPeerRejectionPolicy |
ofPassthrough(Predicate<HttpResponseMetaData> predicate)
Evaluate responses with the given
Predicate as capacity related rejections, that will affect the
CapacityLimiter in use, but allow the original response from the upstream to pass-through this filter. |
static ClientPeerRejectionPolicy |
ofRejection(Predicate<HttpResponseMetaData> rejectionPredicate)
Evaluate responses with the given
Predicate as capacity related rejections, that will affect the
CapacityLimiter in use, and translate that to en exception. |
static ClientPeerRejectionPolicy |
ofRejectionWithRetries(Predicate<HttpResponseMetaData> rejectionPredicate,
Function<HttpResponseMetaData,Duration> delayProvider)
Evaluate responses with the given
Predicate as capacity related rejections, that will affect the
CapacityLimiter in use, and translate that to an exception that contains "delay" information useful when
retrying it through a retrying filter. |
public static final Predicate<HttpResponseMetaData> DEFAULT_CAPACITY_REJECTION_PREDICATE
TrafficResilienceHttpClientFilter.Builder.rejectionPolicy(ClientPeerRejectionPolicy).
The default predicate matches the following HTTP response codes:
HttpResponseStatus.TOO_MANY_REQUESTSHttpResponseStatus.BAD_GATEWAYHttpResponseStatus.SERVICE_UNAVAILABLE
If a CircuitBreaker is used consider adjusting this predicate to avoid considering
HttpResponseStatus.SERVICE_UNAVAILABLE as a capacity issue.
public static final ClientPeerRejectionPolicy DEFAULT_PEER_REJECTION_POLICY
HttpResponseStatus.TOO_MANY_REQUESTSHttpResponseStatus.BAD_GATEWAYHttpResponseStatus.SERVICE_UNAVAILABLEThe default behavior upon such a case, is to issue a retryable exception with no pre-set offset delay (outside the default backoff policy of configured retry filter).
public static ClientPeerRejectionPolicy ofPassthrough(Predicate<HttpResponseMetaData> predicate)
Predicate as capacity related rejections, that will affect the
CapacityLimiter in use, but allow the original response from the upstream to pass-through this filter.predicate - The Predicate to evaluate responses.
Returning true from this Predicate signifies that the response was capacity
related rejection from the peer.ClientPeerRejectionPolicy.public static ClientPeerRejectionPolicy ofRejection(Predicate<HttpResponseMetaData> rejectionPredicate)
Predicate as capacity related rejections, that will affect the
CapacityLimiter in use, and translate that to en exception.rejectionPredicate - The Predicate to evaluate responses.
Returning true from this Predicate signifies that the response was capacity
related rejection from the peer.ClientPeerRejectionPolicy.public static ClientPeerRejectionPolicy ofRejectionWithRetries(Predicate<HttpResponseMetaData> rejectionPredicate, Function<HttpResponseMetaData,Duration> delayProvider)
Predicate as capacity related rejections, that will affect the
CapacityLimiter in use, and translate that to an exception that contains "delay" information useful when
retrying it through a retrying filter.rejectionPredicate - The Predicate to evaluate responses.
Returning true from this Predicate signifies that the response was capacity
related rejection from the peer.delayProvider - A Duration provider for delay purposes when retrying.ClientPeerRejectionPolicy.