public class MultiRetry<T> extends Object
| Constructor and Description |
|---|
MultiRetry(Multi<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
Multi<T> |
atMost(long numberOfAttempts)
|
Multi<T> |
expireAt(long expireAt)
|
Multi<T> |
expireIn(long expireIn)
|
Multi<T> |
indefinitely()
|
Multi<T> |
until(Predicate<? super Throwable> predicate)
|
Multi<T> |
when(Function<Multi<Throwable>,? extends org.reactivestreams.Publisher<?>> whenStreamFactory)
|
MultiRetry<T> |
withBackOff(Duration initialBackOff)
Configures a back-off delay between to attempt to re-subscribe.
|
MultiRetry<T> |
withBackOff(Duration initialBackOff,
Duration maxBackOff)
Configures a back-off delay between to attempt to re-subscribe.
|
MultiRetry<T> |
withJitter(double jitter)
Configures the random factor when using back-off.
|
public Multi<T> indefinitely()
Multi resubscribing to the current Multi until it gets a items followed
by a completion events.
On every failure, it re-subscribes, indefinitely.
Multipublic Multi<T> expireAt(long expireAt)
Multi resubscribing to the current Multi until expireAt time or
until it gets items followed by the completion event. On every failure, it re-subscribes.
If expiration time is passed, the last failure is propagated. Backoff must be configured.
expireAt - absolute time in millis that specifies when to give upMulti retrying to subscribe to the current
Multi until it gets an item or until expiration expireAt. When the expiration is reached,
the last failure is propagated.IllegalArgumentException - if back off not configured,public Multi<T> expireIn(long expireIn)
Multi resubscribing to the current Multi until expireIn time or
until it gets items followed by the completion event. On every failure, it re-subscribes.
If expiration time is passed, the last failure is propagated. Backoff must be configured.
expireIn - relative time in millis that specifies when to give upMulti retrying to subscribe to the current
Multi until it gets an item or until expiration expireIn. When the expiration is reached,
the last failure is propagated.IllegalArgumentException - if back off not configured,public Multi<T> until(Predicate<? super Throwable> predicate)
Multi resubscribing to the current Multi until the given predicate returns false.
The predicate is called with the failure emitted by the current Multi.predicate - the predicate that determines if a re-subscription may happen in case of a specific failure,
must not be null. If the predicate returns true for the given failure, a
re-subscription is attempted.Multi instancepublic Multi<T> when(Function<Multi<Throwable>,? extends org.reactivestreams.Publisher<?>> whenStreamFactory)
Multi resubscribing to the current Multi when the Publisher produced by the
given method emits an item.
As atMost(long), on every failure, it re-subscribes. However, a delay is introduced before
re-subscribing. The re-subscription happens when the produced streams emits an item. If this stream fails,
the downstream gets a failure. It the streams completes, the downstream completes.public MultiRetry<T> withBackOff(Duration initialBackOff)
initialBackOff - the initial back-off duration, must not be null, must not be negative.public MultiRetry<T> withBackOff(Duration initialBackOff, Duration maxBackOff)
maxBackOff.initialBackOff - the initial back-off duration, must not be null, must not be negative.maxBackOff - the max back-off duration, must not be null, must not be negative.public MultiRetry<T> withJitter(double jitter)
jitter - the jitter. Must be in [0.0, 1.0]Copyright © 2019–2020 SmallRye. All rights reserved.