Class CircuitBreakerRuleWithContentBuilder<T extends Response>
java.lang.Object
com.linecorp.armeria.client.AbstractRuleBuilder
com.linecorp.armeria.client.AbstractRuleWithContentBuilder<T>
com.linecorp.armeria.client.circuitbreaker.CircuitBreakerRuleWithContentBuilder<T>
- Type Parameters:
T
- the response type
public final class CircuitBreakerRuleWithContentBuilder<T extends Response>
extends AbstractRuleWithContentBuilder<T>
A builder for creating a new
CircuitBreakerRuleWithContent
.-
Method Summary
Modifier and TypeMethodDescriptionReports aResponse
as a success or failure to aCircuitBreaker
, or ignores it according to the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), if anException
is raised.onException(Class<? extends Throwable> exception)
Adds the specified exception type for aCircuitBreakerRuleWithContent
.onException(BiPredicate<? super ClientRequestContext,? super Throwable> exceptionFilter)
Adds the specifiedexceptionFilter
for aCircuitBreakerRuleWithContent
.onResponse(BiFunction<? super ClientRequestContext,? super T,? extends CompletionStage<Boolean>> responseFilter)
Adds the specifiedresponseFilter
for aCircuitBreakerRuleWithContent
.onResponseHeaders(BiPredicate<? super ClientRequestContext,? super ResponseHeaders> responseHeadersFilter)
Adds the specifiedresponseHeadersFilter
for aCircuitBreakerRuleWithContent
.onResponseTrailers(BiPredicate<? super ClientRequestContext,? super HttpHeaders> responseTrailersFilter)
Adds the specifiedresponseTrailersFilter
for aCircuitBreakerRuleWithContent
.Adds theHttpStatusClass.SERVER_ERROR
for aCircuitBreakerRuleWithContent
.onStatus(HttpStatus... statuses)
Adds the specifiedHttpStatus
es for aCircuitBreakerRuleWithContent
.onStatus(Iterable<HttpStatus> statuses)
Adds the specifiedHttpStatus
es for aCircuitBreakerRuleWithContent
.onStatus(BiPredicate<? super ClientRequestContext,? super HttpStatus> statusFilter)
Adds the specifiedstatusFilter
for aCircuitBreakerRuleWithContent
.onStatusClass(HttpStatusClass... statusClasses)
Adds the specifiedHttpStatusClass
es for aCircuitBreakerRuleWithContent
.onStatusClass(Iterable<HttpStatusClass> statusClasses)
Adds the specifiedHttpStatusClass
es for aCircuitBreakerRuleWithContent
.Reports aResponse
as a success or failure to aCircuitBreaker
, or ignores it according to the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), if anUnprocessedRequestException
, which means that the request has not been processed by the server, is raised.Returns a newly createdCircuitBreakerRuleWithContent
that determines aResponse
as a failure when the rule matches.Returns a newly createdCircuitBreakerRuleWithContent
that ignores aResponse
when the rule matches.Returns a newly createdCircuitBreakerRuleWithContent
that determines aResponse
as a success when the rule matches.Methods inherited from class com.linecorp.armeria.client.AbstractRuleWithContentBuilder
responseFilter
Methods inherited from class com.linecorp.armeria.client.AbstractRuleBuilder
exceptionFilter, requestHeadersFilter, responseHeadersFilter, responseTrailersFilter
-
Method Details
-
thenSuccess
Returns a newly createdCircuitBreakerRuleWithContent
that determines aResponse
as a success when the rule matches. -
thenFailure
Returns a newly createdCircuitBreakerRuleWithContent
that determines aResponse
as a failure when the rule matches. -
thenIgnore
Returns a newly createdCircuitBreakerRuleWithContent
that ignores aResponse
when the rule matches. -
onResponse
public CircuitBreakerRuleWithContentBuilder<T> onResponse(BiFunction<? super ClientRequestContext,? super T,? extends CompletionStage<Boolean>> responseFilter)Adds the specifiedresponseFilter
for aCircuitBreakerRuleWithContent
. If the specifiedresponseFilter
completes withtrue
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onResponse
in classAbstractRuleWithContentBuilder<T extends Response>
-
onResponseHeaders
public CircuitBreakerRuleWithContentBuilder<T> onResponseHeaders(BiPredicate<? super ClientRequestContext,? super ResponseHeaders> responseHeadersFilter)Adds the specifiedresponseHeadersFilter
for aCircuitBreakerRuleWithContent
. If the specifiedresponseHeadersFilter
returnstrue
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onResponseHeaders
in classAbstractRuleBuilder
-
onResponseTrailers
public CircuitBreakerRuleWithContentBuilder<T> onResponseTrailers(BiPredicate<? super ClientRequestContext,? super HttpHeaders> responseTrailersFilter)Adds the specifiedresponseTrailersFilter
for aCircuitBreakerRuleWithContent
. If the specifiedresponseTrailersFilter
returnstrue
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onResponseTrailers
in classAbstractRuleBuilder
-
onStatusClass
Adds the specifiedHttpStatusClass
es for aCircuitBreakerRuleWithContent
. If the class of the response status is one of the specifiedHttpStatusClass
es, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onStatusClass
in classAbstractRuleBuilder
-
onStatusClass
public CircuitBreakerRuleWithContentBuilder<T> onStatusClass(Iterable<HttpStatusClass> statusClasses)Adds the specifiedHttpStatusClass
es for aCircuitBreakerRuleWithContent
. If the class of the response status is one of the specifiedHttpStatusClass
es, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onStatusClass
in classAbstractRuleBuilder
-
onServerErrorStatus
Adds theHttpStatusClass.SERVER_ERROR
for aCircuitBreakerRuleWithContent
. If the class of the response status isHttpStatusClass.SERVER_ERROR
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onServerErrorStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aCircuitBreakerRuleWithContent
. If the response status is one of the specifiedHttpStatus
es, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aCircuitBreakerRuleWithContent
. If the response status is one of the specifiedHttpStatus
es, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
public CircuitBreakerRuleWithContentBuilder<T> onStatus(BiPredicate<? super ClientRequestContext,? super HttpStatus> statusFilter)Adds the specifiedstatusFilter
for aCircuitBreakerRuleWithContent
. If the response status matches the specifiedstatusFilter
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onException
Adds the specified exception type for aCircuitBreakerRuleWithContent
. If anException
is raised and it is an instance of the specifiedexception
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
public CircuitBreakerRuleWithContentBuilder<T> onException(BiPredicate<? super ClientRequestContext,? super Throwable> exceptionFilter)Adds the specifiedexceptionFilter
for aCircuitBreakerRuleWithContent
. If anException
is raised and the specifiedexceptionFilter
returnstrue
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
Reports aResponse
as a success or failure to aCircuitBreaker
, or ignores it according to the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), if anException
is raised.- Overrides:
onException
in classAbstractRuleBuilder
-
onUnprocessed
Reports aResponse
as a success or failure to aCircuitBreaker
, or ignores it according to the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), if anUnprocessedRequestException
, which means that the request has not been processed by the server, is raised.- Overrides:
onUnprocessed
in classAbstractRuleBuilder
-