Class RetryRuleWithContentBuilder<T extends Response>
java.lang.Object
com.linecorp.armeria.client.AbstractRuleBuilder
com.linecorp.armeria.client.AbstractRuleWithContentBuilder<T>
com.linecorp.armeria.client.retry.RetryRuleWithContentBuilder<T>
public final class RetryRuleWithContentBuilder<T extends Response>
extends AbstractRuleWithContentBuilder<T>
A builder for creating a new
RetryRuleWithContent
.-
Method Summary
Modifier and TypeMethodDescriptionMakes aRetryRuleWithContent
retry on anyException
.onException
(Class<? extends Throwable> exception) Adds the specified exception type for aRetryRuleWithContent
which will retry if anException
is raised and it is an instance of the specifiedexception
.onException
(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) Adds the specifiedexceptionFilter
for aRetryRuleWithContent
which will retry if anException
is raised and the specifiedexceptionFilter
returnstrue
.onResponse
(BiFunction<? super ClientRequestContext, ? super T, ? extends CompletionStage<Boolean>> responseFilter) Adds the specifiedresponseFilter
for aRetryRuleWithContent
which will retry if the specifiedresponseFilter
completes withtrue
.onResponseHeaders
(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
for aRetryRuleWithContent
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 aRetryRuleWithContent
which will retry if a class of the response status isHttpStatusClass.SERVER_ERROR
.onStatus
(HttpStatus... statuses) Adds the specifiedHttpStatus
es for aRetryRuleWithContent
which will retry if a response status is one of the specifiedHttpStatus
es.onStatus
(Iterable<HttpStatus> statuses) Adds the specifiedHttpStatus
es for aRetryRuleWithContent
which will retry if a response status is one of the specifiedHttpStatus
es.onStatus
(BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter) Adds the specifiedstatusFilter
for aRetryRuleWithContent
which will retry if a response status matches the specifiedstatusFilter
.onStatusClass
(HttpStatusClass... statusClasses) Adds the specifiedHttpStatusClass
es for aRetryRuleWithContent
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 aRetryRuleWithContent
which will retry if a class of the response status is one of the specifiedHttpStatusClass
es.Makes aRetryRuleWithContent
retry on anUnprocessedRequestException
which means that the request has not been processed by the server.Sets the default backoff and returns a newly createdRetryRuleWithContent
.thenBackoff
(Backoff backoff) Sets the specifiedBackoff
and returns a newly createdRetryRuleWithContent
.Returns a newly createdRetryRuleWithContent
that never retries.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
-
onResponse
public RetryRuleWithContentBuilder<T> onResponse(BiFunction<? super ClientRequestContext, ? super T, ? extends CompletionStage<Boolean>> responseFilter) Adds the specifiedresponseFilter
for aRetryRuleWithContent
which will retry if the specifiedresponseFilter
completes withtrue
.- Overrides:
onResponse
in classAbstractRuleWithContentBuilder<T extends Response>
-
thenBackoff
Sets the default backoff and returns a newly createdRetryRuleWithContent
. -
thenBackoff
Sets the specifiedBackoff
and returns a newly createdRetryRuleWithContent
. -
thenNoRetry
Returns a newly createdRetryRuleWithContent
that never retries. -
onResponseHeaders
public RetryRuleWithContentBuilder<T> onResponseHeaders(BiPredicate<? super ClientRequestContext, ? super ResponseHeaders> responseHeadersFilter) Adds the specifiedresponseHeadersFilter
for aRetryRuleWithContent
which will retry if theresponseHeadersFilter
returnstrue
.- Overrides:
onResponseHeaders
in classAbstractRuleBuilder
-
onResponseTrailers
public RetryRuleWithContentBuilder<T> 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
-
onStatusClass
Adds the specifiedHttpStatusClass
es for aRetryRuleWithContent
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 aRetryRuleWithContent
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 aRetryRuleWithContent
which will retry if a class of the response status isHttpStatusClass.SERVER_ERROR
.- Overrides:
onServerErrorStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aRetryRuleWithContent
which will retry if a response status is one of the specifiedHttpStatus
es.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
Adds the specifiedHttpStatus
es for aRetryRuleWithContent
which will retry if a response status is one of the specifiedHttpStatus
es.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onStatus
public RetryRuleWithContentBuilder<T> onStatus(BiPredicate<? super ClientRequestContext, ? super HttpStatus> statusFilter) Adds the specifiedstatusFilter
for aRetryRuleWithContent
which will retry if a response status matches the specifiedstatusFilter
.- Overrides:
onStatus
in classAbstractRuleBuilder
-
onException
Adds the specified exception type for aRetryRuleWithContent
which will retry if anException
is raised and it is an instance of the specifiedexception
.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
public RetryRuleWithContentBuilder<T> onException(BiPredicate<? super ClientRequestContext, ? super Throwable> exceptionFilter) Adds the specifiedexceptionFilter
for aRetryRuleWithContent
which will retry if anException
is raised and the specifiedexceptionFilter
returnstrue
.- Overrides:
onException
in classAbstractRuleBuilder
-
onException
Makes aRetryRuleWithContent
retry on anyException
.- Overrides:
onException
in classAbstractRuleBuilder
-
onUnprocessed
Makes aRetryRuleWithContent
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
-