liveBook · Manning

Handler

As explained in Akka in Action, Second Edition

An event handler is a function that applies a persisted event to an actor's state during normal processing or recovery replay.

An event handler is a function that applies a persisted event to an actor’s current state, producing the next state during processing or recovery replay. In EventSourcedBehavior, it works with the persistence ID, initial state, and command handler. section 9.2.1

Cargo container state

A persistent cargo container can represent its state as a list of cargo items and its events as CargoAdded values. The event handler turns each persisted event into the updated State.

How Akka in Action, Second Edition covers it

How deep it goes
Defines the function signature and role, but does not show event-specific update logic.
Examples
Uses a cargo-container state and CargoAdded event to illustrate persisted state transitions.
What you can do after
Builds an event-sourced actor by supplying an eventHandler alongside persistence ID, state, and commandHandler.
How it connects
Connects event sourcing with EventSourcedBehavior, state, command handling, persistence IDs, and Akka Persistence.

Also explained in

Compare how 22 books explain handler →

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.