liveBook · Manning

ActorSystem

As explained in Akka in Action, Second Edition

An Akka ActorSystem is the runtime container and entry point for creating and managing actors, their execution, and lifecycle.

ActorSystem is the starting point of an Akka application: it creates top-level actors, roots their hierarchy, and represents the whole system. A common design creates one top-level guardian, which supervises the actors beneath it. The system also provides the configured nexus for capabilities such as scheduling, remoting, and durability extensions. section 1.7.1 section 3.0

Creating an ActorSystem returns an ActorRef rather than direct access to an actor. Send messages through that reference with tell (`!`). In typed Akka, `ActorSystem[Int]` accepts only `Int` messages; attempts to send another type fail at compile time. Actor names are unique among siblings, and actor paths locate references by absolute or relative path. section 1.7.1 section 2.2.3

Start and stop a wallet guardian

Create a typed guardian with `ActorSystem(Wallet(), "wallet")`, send it `1` and `10` using `!`, then call `guardian.terminate()` when the application exits. Graceful termination lets running modules release resources such as HTTP or database connections. section 2.2.3 section 2.2.5

Use an ActorSystem to organize and operate an actor application:

  • Build a parent-child hierarchy: actors created by the system become its children and may create further children. section 3.4
  • Supply or read configuration per system; multiple ActorSystems can have distinct configurations. section 7.2
  • Expose actors to external clients through HTTP or gRPC server endpoints. section 11.0
  • Run black-box asynchronous tests with a real ActorSystem through ActorTestKit and TestProbe. section 4.3
Figure 1.20 TeamChat ActorSystem
CH01_F20_Abraham2

The TeamChat diagram makes the system boundary and its top-level actor hierarchy visible. section 1.7.1

How Akka in Action, Second Edition covers it

How deep it goes
Explains creation, typed messaging, paths, graceful termination, configuration, external ports, and real-system testing without detailing extension internals.
Examples
Demonstrates a typed Wallet guardian receiving integers, terminating on Enter, and external cargo requests through gRPC.
What it assumes
Assumes basic Scala application execution while introducing actor-system creation, typed messaging, and shutdown from zero.
What you can do after
Operate/configure an Akka application by creating a typed guardian, messaging it, supplying settings, and terminating it gracefully.
How it connects
Connects ActorSystem with ActorRef, ActorPath, guardian actors, supervision, configuration, HTTP, gRPC, and ActorTestKit.

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.