Class CircuitBreakerRuleBuilder
java.lang.Object
com.linecorp.armeria.client.AbstractRuleBuilder
com.linecorp.armeria.client.circuitbreaker.CircuitBreakerRuleBuilder
public final class CircuitBreakerRuleBuilder extends AbstractRuleBuilder
A builder for creating a new
CircuitBreakerRule
.-
Method Summary
Methods inherited from class com.linecorp.armeria.client.AbstractRuleBuilder
exceptionFilter, requestHeadersFilter, 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
-
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
-
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
-