RestartSource.withBackoff
Wrap the given Source
Source
with a Source
Source
that will restart it when it fails or completes using an exponential backoff.
Signature
RestartSource.withBackoff
RestartSource.withBackoff
Description
Wrap the given Source
Source
with a Source
Source
that will restart it when it completes or fails using exponential backoff. The backoff resets back to minBackoff
if there hasn’t been a restart within maxRestartsWithin
(which defaults to minBackoff
).
This Source
Source
will not emit a complete or fail as long as maxRestarts is not reached, since the completion or failure of the wrapped Source
Source
is handled by restarting it. The wrapped Source
Source
can however be cancelled by cancelling this Source
Source
. When that happens, the wrapped Source
Source
, if currently running, will be cancelled, and it will not be restarted. This can be triggered simply by the downstream cancelling, or externally by introducing a KillSwitch right after this Source
Source
in the graph.
This uses the same exponential backoff algorithm as BackoffOpts
BackoffOpts
.
See also:
- RestartSource.onFailuresWithBackoff
- RestartFlow.onFailuresWithBackoff
- RestartFlow.withBackoff
- RestartSink.withBackoff
Reactive Streams semantics
emits when the wrapped source emits
backpressures during backoff and when downstream backpressures
completes when maxRestarts
are reached within the given time limit
cancels when downstream cancels