RestartFlow.onFailuresWithBackoff
Wrap the given Flow
Flow
with a Flow
Flow
that will restart it when it fails using an exponential backoff. Notice that this Flow
Flow
will not restart on completion of the wrapped flow.
Signature
RestartFlow.onFailuresWithBackoff
RestartFlow.onFailuresWithBackoff
Description
Wrap the given Flow
Flow
with a Flow
Flow
that will restart it when it fails using exponential backoff. The backoff resets back to minBackoff
if there hasn’t been a restart within maxRestartsWithin
(which defaults to minBackoff
if max restarts).
This Flow
Flow
will not emit any failure as long as maxRestarts is not reached. The failure of the wrapped Flow
Flow
will be handled by restarting it. However, any termination signals sent to this Flow
Flow
will terminate the wrapped Flow
Flow
, if it’s running, and then the Flow
Flow
will be allowed to terminate without being restarted.
The restart process is inherently lossy, since there is no coordination between cancelling and the sending of messages. A termination signal from either end of the wrapped Flow
Flow
will cause the other end to be terminated, and any in transit messages will be lost. During backoff, this Flow
Flow
will backpressure.
This uses the same exponential backoff algorithm as BackoffOpts
BackoffOpts
.
See also:
- RestartSource.withBackoff
- RestartSource.onFailuresWithBackoff
- RestartFlow.withBackoff
- RestartSink.withBackoff
Reactive Streams semantics
emits when the wrapped flow emits
backpressures during backoff and when the wrapped flow backpressures
completes when the wrapped flow completes or maxRestarts
are reached within the given time limit