0

In some of the akka-backoff examples I see that onStop is being used and on some others, I see that onFailure is being used, but I couldn't see an example where both are used for backoff, am I missing something? Isn't it common to backoff on both onStop and onFailure?

onFailure example and: onStop example

val supervisor = BackoffSupervisor.props(
  Backoff.onFailure( // ok this one is onFailure, how to use both onStop?
    childProps,
    childName = "myEcho",
    minBackoff = 3.seconds,

That the supervisor props can be created with either onFailure or onStop, is it possible to use both? how? I haven't seen yet a single example which specifies them both am I missing something?

(in addition, I see I need to specify the child name, am I supposed to guess the child name that has stopped? what if the child name is dynamic?! I don't get the child name meaning.)

Jas
  • 14,493
  • 27
  • 97
  • 148
  • 1
    Any given actor is either going to stop or restart on failure, so you only need to use either `onStop` or `onFailure` to create the supervisor props, not both at the same time. The child name is upto you, it's more for logging purposes than anything else. – Yawar Apr 13 '18 at 00:19
  • When I specify here `childName = "myEcho"` is it applying the backoff supervisor rule only to a child of name "myEcho"? if so how do I apply it to all children of this supervisor? – Jas Apr 13 '18 at 05:47
  • 1
    Make the child an explicit supervisor which has all the children. Give that a default strategy which will be escalate. That escalation will reach this backoff supervisor which will then work as expected. – Yawar Apr 13 '18 at 18:31

0 Answers0