RestartFlow.onFailuresWithBackoff not restarting on failure

We are encountering an unexpected behavior from:

RestartFlow.onFailuresWithBackoff(restartSetting)(flowFactory: () => Flow[In, Out, _])

See RestartFlow.onFailuresWithBackoff. We’re using:

akka:2.6.15 akka-stream-kafka_2.12:2.1.1 scala:2.12.13.

We’re using the following RestartSettings :

RestartSettings(minBackoff=1.seconds, maxBackoff=900.seconds, randomFactor=0.5
  ).withMaxRestarts(maxRestarts=8, maxRestartsWithin=1.seconds)

Expected behavior: The wrapped flow which is wrapped with RestartFlow should restart when failure occurs.

Actual behavior: The wrapped flow is not restarting when the failure occurs; it goes to Supervision.Decider for the failure.

Supervision.Decider is concatenated after the wrapped RestartFlow to handle the scenario where the restart got exhausted and the failure can be handled by Supervision.Decider .

Source → flow1 → flow2 → RestartFlow.onFailuresWithBackoff(flow3) → flow4 + (Supervision.Decider) → Sink