scalaakkaakka-supervision

How to change the Guardian Actor's default Supervisor Strategy Decider?


Is it possible to change the guardian's supervisor strategy to alter its default "Decider" settings. For example, it currently handles ActorKilledExceptions by stopping the child actors. How are we able to change the way it handles these exceptions (i.e. restart when facing these exceptions)?


Solution

  • Citing the docs:

    Since Akka 2.1 it is possible to configure this using the setting akka.actor.guardian-supervisor-strategy, which takes the fully-qualified class-name of a SupervisorStrategyConfigurator.

    In the reference configuration, this happens to be

    guardian-supervisor-strategy = "akka.actor.DefaultSupervisorStrategy"
    

    and it can be changed to any subclass of akka.actor.SupervisorStrategyConfigurator you might create.