public final class ServiceRejectionPolicy
extends Object
TrafficResilienceHttpServiceFilter.| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceRejectionPolicy.Builder
A
ServiceRejectionPolicy builder to support a custom policy. |
| Modifier and Type | Field and Description |
|---|---|
static ServiceRejectionPolicy |
DEFAULT_REJECTION_POLICY
Default response rejection policy.
|
static CharSequence |
RETRY_AFTER_MILLIS
Custom retry-after header that supports milliseconds resolution, rather than seconds.
|
| Modifier and Type | Method and Description |
|---|---|
static Consumer<HttpResponseMetaData> |
retryAfterHint(int seconds)
A hard-coded delay in seconds to be supplied as a Retry-After HTTP header in a
HttpResponseMetaData. |
static BiConsumer<HttpResponseMetaData,StateContext> |
retryAfterHintOfBreaker()
A delay in seconds to be supplied as a Retry-After HTTP header in a
HttpResponseMetaData based on the
CircuitBreaker that matched the HttpRequestMetaData. |
static BiConsumer<HttpResponseMetaData,CircuitBreaker> |
retryAfterMillisHint(Duration duration)
A hard-coded delay in milliseconds to be supplied as a Retry-After-Millis HTTP header in a
HttpResponseMetaData. |
static BiFunction<HttpRequestMetaData,StreamingHttpResponseFactory,Single<StreamingHttpResponse>> |
serviceUnavailable()
Pre-defined
response that signals
HttpResponseStatus.SERVICE_UNAVAILABLE to the peer. |
static BiFunction<HttpRequestMetaData,StreamingHttpResponseFactory,Single<StreamingHttpResponse>> |
tooManyRequests()
Pre-defined
response that signals
HttpResponseStatus.TOO_MANY_REQUESTS to the peer. |
public static final CharSequence RETRY_AFTER_MILLIS
public static final ServiceRejectionPolicy DEFAULT_REJECTION_POLICY
tooManyRequests().serviceUnavailable().public static Consumer<HttpResponseMetaData> retryAfterHint(int seconds)
HttpResponseMetaData.seconds - The value (in seconds) to be used in the Retry-After header.HttpResponseMetaData consumer, that enhances the headers with a fixed Retry-After figure in
seconds.public static BiConsumer<HttpResponseMetaData,StateContext> retryAfterHintOfBreaker()
HttpResponseMetaData based on the
CircuitBreaker that matched the HttpRequestMetaData.HttpResponseMetaData consumer, that enhances the headers with a Retry-After figure in
seconds based on the duration the matching CircuitBreaker will remain open, or a fallback period.public static BiConsumer<HttpResponseMetaData,CircuitBreaker> retryAfterMillisHint(Duration duration)
HttpResponseMetaData. Being a custom Http header, it will require special handling on the peer side.duration - The duration to be used in the Retry-After-Millis header.HttpResponseMetaData consumer, that enhances the headers with a fixed
Retry-After-Millis figure in milliseconds.public static BiFunction<HttpRequestMetaData,StreamingHttpResponseFactory,Single<StreamingHttpResponse>> tooManyRequests()
response that signals
HttpResponseStatus.TOO_MANY_REQUESTS to the peer.BiFunction that regardless the input, it will always return a
too-many-requests response.public static BiFunction<HttpRequestMetaData,StreamingHttpResponseFactory,Single<StreamingHttpResponse>> serviceUnavailable()
response that signals
HttpResponseStatus.SERVICE_UNAVAILABLE to the peer.BiFunction that regardless the input, it will always return a
service-unavailable response.