I noticed that Akkling behaves differently comparing to Akka.FSharp API when it comes to specifying supervision strategy for routers.
Let's say I want to set the following strategy to manage exceptions on router children:
let routeeStrategy () =
Strategy.OneForOne((fun ex ->
Console.WriteLine("Invoking routee strategy")
Console.WriteLine("Restarting actor")
Directive.Restart)
So when creating a router I pass this strategy:
spawn mailbox.UntypedContext actorId { props workerActor with Router = Some routerConfig; SupervisionStrategy = Some <| routeeStrategy() } |> ignore
I also set a strategy on the higher level actor (router supervisor):
let routerStrategy () =
Strategy.OneForOne(fun ex ->
Console.WriteLine("Invoking router strategy")
Console.WriteLine("Resuming actor")
Directive.Resume)
and create a supervisor:
let supervisor = spawn system "runner" <| { props supervisingActor with SupervisionStrategy = Some <| routerStrategy() }
What happens is that the first (routee) strategy is never applied: whenever exception occurs at a routee level, the routerStrategy is applied and the actor is always resumed.
But if I set routeeStrategy when creating a supervisor, then the router itself will be restarted (with all routees). And I only want to restart the single child.
So I am bit lost right now: how do I set two different strategies for the router and its children. Am I overlooking something?
I noticed that Akkling behaves differently comparing to Akka.FSharp API when it comes to specifying supervision strategy for routers.
Let's say I want to set the following strategy to manage exceptions on router children:
let routeeStrategy () =
Strategy.OneForOne((fun ex ->
Console.WriteLine("Invoking routee strategy")
Console.WriteLine("Restarting actor")
Directive.Restart)
So when creating a router I pass this strategy:
spawn mailbox.UntypedContext actorId { props workerActor with Router = Some routerConfig; SupervisionStrategy = Some <| routeeStrategy() } |> ignore
I also set a strategy on the higher level actor (router supervisor):
let routerStrategy () =
Strategy.OneForOne(fun ex ->
Console.WriteLine("Invoking router strategy")
Console.WriteLine("Resuming actor")
Directive.Resume)
and create a supervisor:
let supervisor = spawn system "runner" <| { props supervisingActor with SupervisionStrategy = Some <| routerStrategy() }
What happens is that the first (routee) strategy is never applied: whenever exception occurs at a routee level, the routerStrategy is applied and the actor is always resumed.
But if I set routeeStrategy when creating a supervisor, then the router itself will be restarted (with all routees). And I only want to restart the single child.
So I am bit lost right now: how do I set two different strategies for the router and its children. Am I overlooking something?