Actors / Supervision

Failure & Supervisors

If an actor panics while executing, it will be stopped. To facilitate this, actors must be UnwindSafe.

Actors may be wrapped with Supervisor that can restart the actor (resetting state) or resuming the actor (keeping state).

The following demonstrates this feature:

use pantomime::prelude::*;

Watching Actors

An actor may use ActorContext::watch to be notified when other actors terminate, whether due to normal termination or failure.

When an actor is terminated, all actors that are watching it are notified with a StopReason signal indicating the reason why.

The following demonstrates this feature:

use pantomime::prelude::*;