Interface RetryRuleWithContent<T extends Response>
- Type Parameters:
T
- the response type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RetryRuleWithContent<T extends Response>
-
Method Summary
Modifier and Type Method Description static <T extends Response>
RetryRuleWithContentBuilder<T>builder()
Returns a newly createdRetryRuleWithContentBuilder
.static <T extends Response>
RetryRuleWithContentBuilder<T>builder(HttpMethod... methods)
Returns a newly createdRetryRuleWithContentBuilder
with the specifiedHttpMethod
s.static <T extends Response>
RetryRuleWithContentBuilder<T>builder(Iterable<HttpMethod> methods)
Returns a newly createdRetryRuleWithContentBuilder
with the specifiedHttpMethod
s.static <T extends Response>
RetryRuleWithContentBuilder<T>builder(BiPredicate<? super ClientRequestContext,? super RequestHeaders> requestHeadersFilter)
Returns a newly createdRetryRuleWithContentBuilder
with the specifiedrequestHeadersFilter
.static <T extends Response>
RetryRuleWithContent<T>of(RetryRuleWithContent<T>... retryRules)
Returns aRetryRuleWithContent
that combines the specifiedretryRules
.static <T extends Response>
RetryRuleWithContent<T>of(Iterable<? extends RetryRuleWithContent<T>> retryRules)
static <T extends Response>
RetryRuleWithContent<T>onResponse(BiFunction<? super ClientRequestContext,? super T,? extends CompletionStage<Boolean>> retryFunction)
Returns a newly createdRetryRuleWithContent
that will retry with the default backoff if the specifiedretryFunction
completes withtrue
.default RetryRuleWithContent<T>
orElse(RetryRule other)
Returns a composedRetryRuleWithContent
that represents a logical OR of thisRetryRuleWithContent
and the specifiedRetryRule
.default RetryRuleWithContent<T>
orElse(RetryRuleWithContent<T> other)
Returns a composedRetryRuleWithContent
that represents a logical OR of thisRetryRuleWithContent
and another.default boolean
requiresResponseTrailers()
Returns whether this rule requires the response trailers to determine if aResponse
is successful or not.CompletionStage<RetryDecision>
shouldRetry(ClientRequestContext ctx, T response, Throwable cause)
Tells whether the request sent with the specifiedClientRequestContext
requires a retry or not.
-
Method Details
-
onResponse
static <T extends Response> RetryRuleWithContent<T> onResponse(BiFunction<? super ClientRequestContext,? super T,? extends CompletionStage<Boolean>> retryFunction)Returns a newly createdRetryRuleWithContent
that will retry with the default backoff if the specifiedretryFunction
completes withtrue
. -
builder
Returns a newly createdRetryRuleWithContentBuilder
. -
builder
Returns a newly createdRetryRuleWithContentBuilder
with the specifiedHttpMethod
s. -
builder
Returns a newly createdRetryRuleWithContentBuilder
with the specifiedHttpMethod
s. -
builder
static <T extends Response> RetryRuleWithContentBuilder<T> builder(BiPredicate<? super ClientRequestContext,? super RequestHeaders> requestHeadersFilter)Returns a newly createdRetryRuleWithContentBuilder
with the specifiedrequestHeadersFilter
. -
of
@SafeVarargs static <T extends Response> RetryRuleWithContent<T> of(RetryRuleWithContent<T>... retryRules)Returns aRetryRuleWithContent
that combines the specifiedretryRules
. -
of
static <T extends Response> RetryRuleWithContent<T> of(Iterable<? extends RetryRuleWithContent<T>> retryRules) -
orElse
Returns a composedRetryRuleWithContent
that represents a logical OR of thisRetryRuleWithContent
and the specifiedRetryRule
. If thisRetryRuleWithContent
completes withRetryDecision.next()
, then otherRetryRule
is evaluated. -
orElse
Returns a composedRetryRuleWithContent
that represents a logical OR of thisRetryRuleWithContent
and another. If thisRetryRuleWithContent
completes withRetryDecision.next()
, then otherRetryRuleWithContent
is evaluated. -
shouldRetry
CompletionStage<RetryDecision> shouldRetry(ClientRequestContext ctx, @Nullable T response, @Nullable Throwable cause)Tells whether the request sent with the specifiedClientRequestContext
requires a retry or not. Implement this method to return aCompletionStage
and to complete it with a desiredBackoff
. To stop trying further, complete it withnull
.- Parameters:
ctx
- theClientRequestContext
of this request.response
- theResponse
from the server.null
if aThrowable
is raised before receiving the content of theResponse
.cause
- theThrowable
which is raised while sending a request and before receiving the content of theResponse
.null
if there's no exception.
-
requiresResponseTrailers
default boolean requiresResponseTrailers()Returns whether this rule requires the response trailers to determine if aResponse
is successful or not.
-