4

According to the Akka docs on the System Guardian, if a top-level actor throws an Exception, it will be restarted indefinitely (with 2 exceptions - no pun intended).

My actor system has 1 and only 1 top-level actor: Initializer. If Initializer throws an exception, I would like a different SuervisorStrategy applied to it, if at all possible:

  • Restart Initializer up to 3 times
  • If that doesn't work, then stop/terminate it

How could I implement this custom strategy for the System Guardian?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
smeeb
  • 27,777
  • 57
  • 250
  • 447

1 Answers1

4

You can set the guardian supervision strategy with the configuration key akka.guardian-supervisor-strategy in your application.conf, which has the default "akka.actor.DefaultSupervisorStrategy".

See this section of the docs for more info: http://doc.akka.io/docs/akka/current/general/configuration.html#akka-actor

johanandren
  • 11,249
  • 1
  • 25
  • 30