Flux of RetrySignal,
for use with Flux#retryWhen(Retry) and reactor.core.publisher.Mono#retryWhen(Retry) .
Also provides access to configurable built-in strategies via static factory methods:
Users are encouraged to provide either concrete custom Retry strategies or builders that produce
such concrete Retry. The RetrySpec returned by e.g. max(long) is a good inspiration
for a fluent approach that generates a Retry at each step and uses immutability/copy-on-write to enable
sharing of intermediate steps (that can thus be considered templates).
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Retry.RetrySignal
State used in |
| Modifier and Type | Field and Description |
|---|---|
| public final ContextView |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static RetryBackoffSpec | Returns: the exponential backoff spec for further configurationthe maximum number of retry attempts to allow maxAttempts, Duration the minimum minBackoff)Duration for the first backoffA |
| public static RetryBackoffSpec | Returns: the fixed delays spec for further configurationthe maximum number of retry attempts to allow maxAttempts, Duration the fixedDelay)Duration of the fixed delaysA |
| public static final Retry | |
| public abstract Publisher | Returns: the companion publisher responsible for reacting to incomingRetrySignal emissions,
effectively deciding when to retry.the errors from the outer publisher as retrySignalsRetrySignal objects,
containing the Throwable causing the error as well as retry counter metadata.Generates the companion publisher responsible for reacting to incoming |
| public static RetrySpec | Returns: the retry indefinitely spec for further configurationA |
| public static RetrySpec | |
| public static RetrySpec | |
| public ContextView | Returns: the user provided context that will be accessible viaRetrySignal#retryContextView().Return the user provided context that was set at construction time. |
| public static final Retry |
| retryContext | back to summary |
|---|---|
| public final ContextView retryContext | |
| Retry | back to summary |
|---|---|
| public Retry() | |
| Retry | back to summary |
|---|---|
| protected Retry(ContextView retryContext) | |
| backoff | back to summary |
|---|---|
| public static RetryBackoffSpec backoff(long maxAttempts, Duration minBackoff) A
| |
| fixedDelay | back to summary |
|---|---|
| public static RetryBackoffSpec fixedDelay(long maxAttempts, Duration fixedDelay) A
Note that calling
| |
| from | back to summary |
|---|---|
| public static final Retry from(Function<Flux<Retry. A wrapper around | |
| generateCompanion | back to summary |
|---|---|
| public abstract Publisher Generates the companion publisher responsible for reacting to incoming
When the source signals an error, that The response to that request decides if a retry should be made. Thus, the outer publisher will wait until a signal is emitted by the companion publisher, making it possible to delay retry attempts.
Any
As an example, the simplest form of retry companion would be to return the incoming
| |
| indefinitely | back to summary |
|---|---|
| public static RetrySpec indefinitely() A
| |
| max | back to summary |
|---|---|
| public static RetrySpec max(long max) A
| |
| maxInARow | back to summary |
|---|---|
| public static RetrySpec maxInARow(long maxInARow) A
| |
| retryContext | back to summary |
|---|---|
| public ContextView retryContext() Return the user provided context that was set at construction time.
| |
| withThrowable | back to summary |
|---|---|
| public static final Retry withThrowable(Function<Flux<Throwable>, ? extends Publisher<?>> function) An adapter for | |
Flux#retryWhen(Retry) and reactor.core.publisher.Mono#retryWhen(Retry) ,
providing the Throwable that caused the source to fail as well as counters keeping track of retries.
| Modifier and Type | Method and Description |
|---|---|
| public default Retry. | Returns: an immutable copy of the currentRetrySignal, always safe to useAn immutable copy of this |
| public Throwable | |
| public default ContextView | Returns: a read-only view of a user provided context.Return a read-only view of the user provided context, which may be used to store objects to be reset/rolled-back or otherwise mutated before or after a retry. |
| public long | Returns: the total number of retries since the source first was subscribed to.The total number of retries since the source first was subscribed to (in other words the number of errors -1 since the source was first subscribed to). |
| public long | Returns: the number of retries since the latestonNext,
or the number of retries since the source first was subscribed to if there hasn't been any
onNext signals (in which case
RetrySignal#totalRetries() and RetrySignal#totalRetriesInARow() are equivalent).Retry counter resetting after each |
| copy | back to summary |
|---|---|
| public default Retry. An immutable copy of this
| |
| failure | back to summary |
|---|---|
| public Throwable failure() The
| |
| retryContextView | back to summary |
|---|---|
| public default ContextView retryContextView() Return a read-only view of the user provided context, which may be used to store objects to be reset/rolled-back or otherwise mutated before or after a retry.
| |
| totalRetries | back to summary |
|---|---|
| public long totalRetries() The total number of retries since the source first was subscribed to (in other words the number of errors -1 since the source was first subscribed to).
| |
| totalRetriesInARow | back to summary |
|---|---|
| public long totalRetriesInARow() Retry counter resetting after each
| |