Akka Actor custom Supervisors

723 Views Asked by At

Akka docs say to configure

akka.actor.guardian-supervisor-strategy, which takes the fully-qualified class-name of a SupervisorStrategyConfigurator

SupervisorStrategyConfigurator is a trait. Do I need to extend any classes with my subclassed trait? Or do I just define the trait and specify it in the configs, causing Akka to generate the guardian actor with that trait?

1

There are 1 best solutions below

0
On

The default value of akka.actor.guardian-supervisor-strategy is "akka.actor.DefaultSupervisorStrategy"(It is also default for any actor created without a specific supervisorStrategy). There are two known subclasses of SupervisorStrategyConfigurator (DefaultSupervisorStrategy and StoppingSupervisorStrategy). You can see the source code here.

If you want a custom one you need to extend SupervisorStrategyConfigurator and specify in the config file. An example for configuration:

akka.actor.guardian-supervisor-strategy = "com.example.MySupervisorStrategy"