public class DefaultRetry<T> extends AbstractRetry<T,Throwable> implements Retry<T>
Modifier and Type | Method and Description |
---|---|
Publisher<Long> |
apply(Flux<Throwable> errors) |
Retry<T> |
backoff(Backoff backoff)
Returns a retry function with backoff delay.
|
static <T> DefaultRetry<T> |
create(java.util.function.Predicate<? super RetryContext<T>> retryPredicate) |
Retry<T> |
doOnRetry(java.util.function.Consumer<? super RetryContext<T>> onRetry)
Returns a retry function that invokes the provided onRetry
callback before every retry.
|
Retry<T> |
jitter(Jitter jitter)
Returns a retry function that applies jitter to the backoff delay.
|
Retry<T> |
retryMax(long maxIterations)
Retry function that retries n times.
|
Retry<T> |
timeout(java.time.Duration timeout)
Returns a retry function with timeout.
|
String |
toString() |
Retry<T> |
withApplicationContext(T applicationContext)
Returns a retry function with an application context that may be
used to perform any rollbacks before a retry.
|
Retry<T> |
withBackoffScheduler(Scheduler scheduler)
Returns a retry function that uses the scheduler provided for
backoff delays.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
allBut, any, anyOf, apply, exponentialBackoff, exponentialBackoffWithJitter, fixedBackoff, noBackoff, onlyIf, randomBackoff, retryOnce
andThen, compose, identity
public static <T> DefaultRetry<T> create(java.util.function.Predicate<? super RetryContext<T>> retryPredicate)
public Retry<T> withApplicationContext(T applicationContext)
Retry
Retry.onlyIf(Predicate)
,
custom backoff function Retry.backoff(Backoff)
and retry
callback Retry.doOnRetry(Consumer)
. All other properties of
this retry function are retained in the returned instance.withApplicationContext
in interface Retry<T>
applicationContext
- Application contextpublic Retry<T> doOnRetry(java.util.function.Consumer<? super RetryContext<T>> onRetry)
Retry
RetryContext
provided
to the callback contains the iteration and the any application
context set using Retry.withApplicationContext(Object)
.
All other properties of this retry function are retained in the
returned instance.public Retry<T> retryMax(long maxIterations)
Retry
public Retry<T> timeout(java.time.Duration timeout)
Retry
public Retry<T> backoff(Backoff backoff)
Retry
public Retry<T> jitter(Jitter jitter)
Retry
public Retry<T> withBackoffScheduler(Scheduler scheduler)
Retry
withBackoffScheduler
in interface Retry<T>
scheduler
- the scheduler for backoff delayspublic Publisher<Long> apply(Flux<Throwable> errors)
apply
in interface java.util.function.Function<Flux<Throwable>,Publisher<Long>>