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:
Initializer
up to 3 timesHow could I implement this custom strategy for the System Guardian?
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