Class CircuitBreakerRuleBuilder
java.lang.Object
com.linecorp.armeria.client.AbstractRuleBuilder
com.linecorp.armeria.client.circuitbreaker.CircuitBreakerRuleBuilder
A builder for creating a new
CircuitBreakerRule
.-
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 aCircuitBreakerRule
.onException
(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) Adds the specifiedexceptionFilter
for aCircuitBreakerRule
.onGrpcTrailers
(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> grpcTrailersFilter) Adds the specifiedgrpcTrailersFilter
for aCircuitBreakerRule
.onResponseHeaders
(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
for aCircuitBreakerRule
.onResponseTrailers
(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter) Adds the specifiedresponseTrailersFilter
for aCircuitBreakerRule
.Adds theHttpStatusClass.SERVER_ERROR
for aCircuitBreakerRule
.onStatus
(HttpStatus... statuses) Adds the specifiedHttpStatus
es for aCircuitBreakerRule
.onStatus
(Iterable<HttpStatus> statuses) Adds the specifiedHttpStatus
es for aCircuitBreakerRule
.onStatus
(BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter) Adds the specifiedstatusFilter
for aCircuitBreakerRule
.onStatusClass
(HttpStatusClass... statusClasses) Adds the specifiedHttpStatusClass
es for aCircuitBreakerRule
.onStatusClass
(Iterable<HttpStatusClass> statusClasses) Adds the specifiedHttpStatusClass
es for aCircuitBreakerRule
.Reports aResponse
as a success or failure to aCircuitBreaker
, or ignores it according to the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), if aTimeoutException
is raised.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 createdCircuitBreakerRule
that determines aResponse
as a failure when the rule matches.Returns a newly createdCircuitBreakerRule
that ignores aResponse
when the rule matches.Returns a newly createdCircuitBreakerRule
that determines aResponse
as a success when the rule matches.Methods inherited from class com.linecorp.armeria.client.AbstractRuleBuilder
exceptionFilter, grpcTrailersFilter, requestHeadersFilter, requiresResponseTrailers, responseHeadersFilter, responseTrailersFilter
-
Method Details
-
thenSuccess
Returns a newly createdCircuitBreakerRule
that determines aResponse
as a success when the rule matches. -
thenFailure
Returns a newly createdCircuitBreakerRule
that determines aResponse
as a failure when the rule matches. -
thenIgnore
Returns a newly createdCircuitBreakerRule
that ignores aResponse
when the rule matches. -
onResponseHeaders
public CircuitBreakerRuleBuilder onResponseHeaders(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
for aCircuitBreakerRule
. 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 CircuitBreakerRuleBuilder onResponseTrailers(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter) Adds the specifiedresponseTrailersFilter
for aCircuitBreakerRule
. 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
-
onGrpcTrailers
public CircuitBreakerRuleBuilder onGrpcTrailers(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> grpcTrailersFilter) Adds the specifiedgrpcTrailersFilter
for aCircuitBreakerRule
. If the specifiedgrpcTrailersFilter
returnstrue
, depending on the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), aResponse
is reported as a success or failure to aCircuitBreaker
or ignored.- Overrides:
onGrpcTrailers
in classAbstractRuleBuilder
-
onStatusClass
Adds the specifiedHttpStatusClass
es for aCircuitBreakerRule
. 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
Adds the specifiedHttpStatusClass
es for aCircuitBreakerRule
. 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 aCircuitBreakerRule
. 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 aCircuitBreakerRule
. 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 aCircuitBreakerRule
. 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 CircuitBreakerRuleBuilder onStatus(BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter) Adds the specifiedstatusFilter
for aCircuitBreakerRule
. 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 aCircuitBreakerRule
. 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 CircuitBreakerRuleBuilder onException(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) Adds the specifiedexceptionFilter
for aCircuitBreakerRule
. 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
-
onTimeoutException
Reports aResponse
as a success or failure to aCircuitBreaker
, or ignores it according to the build methods(thenSuccess()
,thenFailure()
andthenIgnore()
), if aTimeoutException
is raised.- Overrides:
onTimeoutException
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
-