liveBook · Manning

Supervisor behavior

As explained in Akka in Action, Second Edition

Supervisor behavior is recovery logic that observes actor failures and selects a predefined response for the failed actor.

Supervisor behavior separates domain processing from recovery. Actors keep only happy-path message handling; when an exception occurs, the actor crashes and the supervisor chooses a predefined response. section 5.1.2

Selects one of three responses for the failed actor:

  • Restart recreates the actor, while its ActorRef and mailbox continue serving the rest of the application. section 5.1.2
  • Resume keeps the same actor instance processing messages and logs the exception through the supervisor. section 5.1.2
  • Stop terminates the actor so it no longer processes messages. section 5.1.2
Figure 5.6 Supervisor wrapping an actor’s behavior and deciding on a recovery action after an exception
CH05_F06_Abraham2

Shows the supervisor wrapping actor behavior and selecting a recovery action after an exception. section 5.1.2

How Akka in Action, Second Edition covers it

How deep it goes
Defines mailbox suspension and three recovery strategies, but defers special handling for recovering the failed message.
Examples
Uses a supervisor-wrapped actor diagram to show exception handling and recovery selection.
What it assumes
Assumes actors process messages and exceptions can interrupt that processing.
What you can do after
Evaluate/understand how actor failures trigger restart, resume, or stop without embedding recovery in business logic.
How it connects
Connects actors, exceptions, mailboxes, ActorRef, and predefined restart, resume, and stop strategies.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.