Allow RestartSource.withBackoff to restart only on failures #23881 (#23911)

* Allow RestartSource.withBackoff to restart only on failures #23881
This commit is contained in:
nachinius 2017-11-13 09:47:27 -03:00 committed by Patrik Nordwall
parent bb9d3927c8
commit 53bbd5ab5f
5 changed files with 123 additions and 30 deletions

View file

@ -67,7 +67,7 @@ Java
Just as Akka provides the @ref:[backoff supervision pattern for actors](../general/supervision.md#backoff-supervisor), Akka streams
also provides a `RestartSource`, `RestartSink` and `RestartFlow` for implementing the so-called *exponential backoff
supervision strategy*, starting a stage again when it fails, each time with a growing time delay between restarts.
supervision strategy*, starting a stage again when it fails or completes, each time with a growing time delay between restarts.
This pattern is useful when the stage fails or completes because some external resource is not available
and we need to give it some time to start-up again. One of the prime examples when this is useful is

View file

@ -56,7 +56,6 @@ public class RestartDocTest {
Duration.apply(3, TimeUnit.SECONDS), // min backoff
Duration.apply(30, TimeUnit.SECONDS), // max backoff
0.2, // adds 20% "noise" to vary the intervals slightly
() ->
// Create a source from a future of a source
Source.fromSourceCompletionStage(