Class RetryRuleBuilder
java.lang.Object
com.linecorp.armeria.client.AbstractRuleBuilder
com.linecorp.armeria.client.retry.RetryRuleBuilder
A builder for creating a new
RetryRule
.-
Method Summary
Modifier and TypeMethodDescriptiononException
(Class<? extends Throwable> exception) onException
(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) onGrpcTrailers
(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> grpcTrailersFilter) Adds the specifiedgrpcTrailersFilter
for aRetryRuleWithContent
which will retry if thegrpcTrailersFilter
returnstrue
.onResponseHeaders
(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
for aRetryRule
which will retry if theresponseHeadersFilter
returnstrue
.onResponseTrailers
(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter) Adds the specifiedresponseTrailersFilter
for aRetryRuleWithContent
which will retry if theresponseTrailersFilter
returnstrue
.Adds theHttpStatusClass.SERVER_ERROR
for aRetryRule
which will retry if a class of the response status isHttpStatusClass.SERVER_ERROR
.onStatus
(HttpStatus... statuses) Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.onStatus
(Iterable<HttpStatus> statuses) Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.onStatus
(BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter) Adds the specifiedstatusFilter
for aRetryRule
which will retry if a response status matches the specifiedstatusFilter
.onStatusClass
(HttpStatusClass... statusClasses) Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.onStatusClass
(Iterable<HttpStatusClass> statusClasses) Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.Makes aRetryRule
retry on aTimeoutException
.Makes aRetryRule
retry on anUnprocessedRequestException
which means that the request has not been processed by the server.Sets the default backoff and returns a newly createdRetryRule
.thenBackoff
(Backoff backoff) Returns a newly createdRetryRule
that never retries.Methods inherited from class com.linecorp.armeria.client.AbstractRuleBuilder
exceptionFilter, grpcTrailersFilter, requestHeadersFilter, requiresResponseTrailers, responseHeadersFilter, responseTrailersFilter
-
Method Details
-
thenBackoff
Sets the default backoff and returns a newly createdRetryRule
. -
thenBackoff
-
thenNoRetry
Returns a newly createdRetryRule
that never retries. -
onResponseHeaders
public RetryRuleBuilder onResponseHeaders(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
for aRetryRule
which will retry if theresponseHeadersFilter
returnstrue
.- Overrides:
onResponseHeaders
in classAbstractRuleBuilder
-
onResponseTrailers
public RetryRuleBuilder onResponseTrailers(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> responseTrailersFilter) Adds the specifiedresponseTrailersFilter
for aRetryRuleWithContent
which will retry if theresponseTrailersFilter
returnstrue
. Note that using this method makes the entire response buffered, which may lead to excessive memory usage.- Overrides:
onResponseTrailers
in classAbstractRuleBuilder
-
onGrpcTrailers
public RetryRuleBuilder onGrpcTrailers(BiPredicate<? super ClientRequestContext, ? super HttpHeaders> grpcTrailersFilter) Adds the specifiedgrpcTrailersFilter
for aRetryRuleWithContent
which will retry if thegrpcTrailersFilter
returnstrue
. Note that using this method makes the entire response buffered, which may lead to excessive memory usage.- Overrides:
onGrpcTrailers
in classAbstractRuleBuilder
-
onStatusClass
Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.- Overrides:
onStatusClass
in classAbstractRuleBuilder
-
onStatusClass
Adds the specifiedHttpStatusClass
es for aRetryRule
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.- Overrides:
onStatusClass
in classAbstractRuleBuilder
-
onServerErrorStatus
Adds theHttpStatusClass.SERVER_ERROR
for aRetryRule
which will retry if a class of the response status isHttpStatusClass.SERVER_ERROR
.- Overrides:
onServerErrorStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aRetryRule
which will retry if a response status is one of the specifiedHttpStatus
es.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
public RetryRuleBuilder onStatus(BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter) Adds the specifiedstatusFilter
for aRetryRule
which will retry if a response status matches the specifiedstatusFilter
.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onException
Adds the specified exception type for aRetryRule
which will retry if anException
is raised and it is an instance of the specifiedexception
.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
public RetryRuleBuilder onException(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) Adds the specifiedexceptionFilter
for aRetryRule
which will retry if anException
is raised and the specifiedexceptionFilter
returnstrue
.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
- Overrides:
onException
in classAbstractRuleBuilder
-
onTimeoutException
Makes aRetryRule
retry on aTimeoutException
.- Overrides:
onTimeoutException
in classAbstractRuleBuilder
-
onUnprocessed
Makes aRetryRule
retry on anUnprocessedRequestException
which means that the request has not been processed by the server. Therefore, you can safely retry the request without worrying about the idempotency of the request.- Overrides:
onUnprocessed
in classAbstractRuleBuilder
-