RestartSource.onFailuresWithBackoff

Wrap the given SourceSource with a SourceSource that will restart it when it fails using an exponential backoff.

Error handling

Signature

def onFailuresWithBackoff[T](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double)(sourceFactory: () ⇒ Source[T, _]): Source[T, NotUsed]
def onFailuresWithBackoff[T](minBackoff: FiniteDuration, maxBackoff: FiniteDuration, randomFactor: Double, maxRestarts: Int)(sourceFactory: () ⇒ Source[T, _]): Source[T, NotUsed]

Description

This SourceSource will never emit a failure, since the failure of the wrapped SourceSource is always handled by restarting. The wrapped SourceSource can be cancelled by cancelling this SourceSource. When that happens, the wrapped SourceSource, 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 KillSwitchKillSwitch right after this SourceSource in the graph.

Reactive Streams semantics

emits when the wrapped source emits

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.