Expand description

An event sourced entity (also known as a persistent entity) receives a (non-persistent) command which is first validated if it can be applied to the current state. Here validation can mean anything, from simple inspection of a command message’s fields up to a conversation with several external services, for example. If validation succeeds, events are generated from the command, representing the effect of the command. These events are then persisted and, after successful persistence, used to change the entity’s state. When the event sourced actor needs to be recovered, only the persisted events are replayed of which we know that they can be successfully applied. In other words, events cannot fail when being replayed to a persistent entity, in contrast to commands. Event sourced entities may also process commands that do not change application state such as query commands for example.

Structs

  • A context provides information about the environment that hosts a specific entity.

Traits

  • An entity’s behavior is the basic unit of modelling aspects of an Akka-Persistence-based application and encapsulates how commands can be applied to state, including the emission of events. Events can also be applied to state in order to produce more state.