Class AbstractRuleBuilder<SELF extends AbstractRuleBuilder<SELF>>
- Direct Known Subclasses:
AbstractRuleWithContentBuilder
,CircuitBreakerRuleBuilder
,RetryRuleBuilder
RetryRule
, RetryRuleWithContent
,
CircuitBreakerRule
and CircuitBreakerRuleWithContent
.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractRuleBuilder
(BiPredicate<? super ClientRequestContext, ? super RequestHeaders> requestHeadersFilter) Creates a new instance with the specifiedrequestHeadersFilter
. -
Method Summary
Modifier and TypeMethodDescriptionprotected final @Nullable BiPredicate
<ClientRequestContext, Throwable> Returns theBiPredicate
of anException
.protected final @Nullable BiPredicate
<ClientRequestContext, HttpHeaders> Returns theBiPredicate
of gRPC trailers.Adds anyException
.onException
(Class<? extends Throwable> exception) Adds the specified exception type.onException
(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) Adds the specifiedexceptionFilter
.onGrpcTrailers
(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> grpcTrailersFilter) Adds the specifiedgrpcTrailersFilter
.onResponseHeaders
(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
.onResponseTrailers
(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter) Adds the specifiedresponseTrailersFilter
.Adds theHttpStatusClass.SERVER_ERROR
.onStatus
(HttpStatus... statuses) Adds the specifiedHttpStatus
es.onStatus
(Iterable<HttpStatus> statuses) Adds the specifiedHttpStatus
es.onStatus
(BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter) Adds the specifiedstatusFilter
.onStatusClass
(HttpStatusClass... statusClasses) Adds the specifiedHttpStatusClass
es.onStatusClass
(Iterable<HttpStatusClass> statusClasses) Adds the specifiedHttpStatusClass
es.AddsTimeoutException
.onTotalDuration
(BiPredicate<? super ClientRequestContext, ? super Duration> totalDurationFilter) Adds the specifiedtotalDurationFilter
.Adds anUnprocessedRequestException
.protected final BiPredicate
<ClientRequestContext, RequestHeaders> Returns theBiPredicate
of aRequestHeaders
.protected final boolean
Returns whether this rule being built requires HTTP response trailers.protected final @Nullable BiPredicate
<ClientRequestContext, ResponseHeaders> Returns theBiPredicate
of aResponseHeaders
.protected final @Nullable BiPredicate
<ClientRequestContext, HttpHeaders> Returns theBiPredicate
of a response trailers.protected final @Nullable BiPredicate
<ClientRequestContext, Duration> Returns thenPredicate
of total duration.
-
Constructor Details
-
AbstractRuleBuilder
protected AbstractRuleBuilder(BiPredicate<? super ClientRequestContext, ? super RequestHeaders> requestHeadersFilter) Creates a new instance with the specifiedrequestHeadersFilter
.
-
-
Method Details
-
onResponseHeaders
public SELF onResponseHeaders(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
.When this is used for a
CircuitBreakerRule
, and the specifiedresponseHeadersFilter
returnstrue
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onResponseTrailers
public SELF onResponseTrailers(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter) Adds the specifiedresponseTrailersFilter
. Note that using this method makes the entire response buffered, which may lead to excessive memory usage.When this is used for a
CircuitBreakerRule
, and the specifiedresponseTrailersFilter
returnstrue
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onGrpcTrailers
public SELF onGrpcTrailers(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> grpcTrailersFilter) Adds the specifiedgrpcTrailersFilter
. Note that using this method makes the entire response buffered, which may lead to excessive memory usage.When this is used for a
CircuitBreakerRule
, and the specifiedgrpcTrailersFilter
returnstrue
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onStatusClass
Adds the specifiedHttpStatusClass
es.When this is used for a
CircuitBreakerRule
, and the response status is one of the specifiedHttpStatusClass
es, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onStatusClass
Adds the specifiedHttpStatusClass
es.When this is used for a
CircuitBreakerRule
, and the response status is one of the specifiedHttpStatusClass
es, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onServerErrorStatus
Adds theHttpStatusClass.SERVER_ERROR
.When this is used for a
CircuitBreakerRule
, and the response status isHttpStatusClass.SERVER_ERROR
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onStatus
Adds the specifiedHttpStatus
es.When this is used for a
CircuitBreakerRule
, and the response status is one of the specifiedHttpStatus
es, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onStatus
Adds the specifiedHttpStatus
es.When this is used for a
CircuitBreakerRule
, and the response status is one of the specifiedHttpStatus
es, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onStatus
Adds the specifiedstatusFilter
.When this is used for a
CircuitBreakerRule
, and the response status matches the specifiedstatusFilter
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onException
Adds the specified exception type.When this is used for a
CircuitBreakerRule
, and the raised exception is an instance of the specifiedexception
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onException
public SELF onException(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) Adds the specifiedexceptionFilter
.When this is used for a
CircuitBreakerRule
, and the specifiedexceptionFilter
returnstrue
for the raised exception, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onException
Adds anyException
.When this is used for a
CircuitBreakerRule
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onTimeoutException
AddsTimeoutException
.When this is used for a
CircuitBreakerRule
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onUnprocessed
Adds anUnprocessedRequestException
.When this is used for a
CircuitBreakerRule
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
onTotalDuration
public SELF onTotalDuration(BiPredicate<? super ClientRequestContext, ? super Duration> totalDurationFilter) Adds the specifiedtotalDurationFilter
.When this is used for a
CircuitBreakerRule
, and the specifiedtotalDurationFilter
returnstrue
, aResponse
is reported as a success or failure to aCircuitBreaker
or ignored depending on the build methods(#thenSuccess()
,#thenFailure()
and#thenIgnore()
). -
requestHeadersFilter
Returns theBiPredicate
of aRequestHeaders
. -
responseHeadersFilter
@Nullable protected final @Nullable BiPredicate<ClientRequestContext,ResponseHeaders> responseHeadersFilter()Returns theBiPredicate
of aResponseHeaders
. -
responseTrailersFilter
@Nullable protected final @Nullable BiPredicate<ClientRequestContext,HttpHeaders> responseTrailersFilter()Returns theBiPredicate
of a response trailers. -
exceptionFilter
Returns theBiPredicate
of anException
. -
grpcTrailersFilter
@Nullable protected final @Nullable BiPredicate<ClientRequestContext,HttpHeaders> grpcTrailersFilter()Returns theBiPredicate
of gRPC trailers. -
totalDurationFilter
@Nullable protected final @Nullable BiPredicate<ClientRequestContext,Duration> totalDurationFilter()Returns thenPredicate
of total duration. -
requiresResponseTrailers
protected final boolean requiresResponseTrailers()Returns whether this rule being built requires HTTP response trailers.
-