Coerce-rs icon indicating copy to clipboard operation
Coerce-rs copied to clipboard

Request: Supervision Strategies / Agent Restart Behaviors

Open daveman1010221 opened this issue 1 year ago • 1 comments

It's possible I've missed this, but I haven't been able to figure out how a supervised actor (one that is spawned by another) might be restarted, in the event of a failure case.

daveman1010221 avatar Jul 07 '23 14:07 daveman1010221

Hi @daveman1010221

There are currently only 2 ways actors will be restarted/re-attempted to be started automatically in the event of a failure:

  • Sharded actors will be automatically restarted on a healthy node, in the event of a shard or node failure
  • Persistent actors that are failing to recover can be configured to keep re-trying, by using the Retry failure policy.

For cases not covered, I think it's difficult to define what is an "actor failure", which is easy with runtimes like Akka/Akka.NET since exceptions exist, and can be caught.

When an actor that was spawned by a parent actor stops, a notification is sent to the supervising actor, for which the handling can be overridden via the on_child_stopped function - inside there you could implement custom logic to re-start any actors that were stopped.

Cheers, Leon

LeonHartley avatar Jul 07 '23 22:07 LeonHartley