Nexus API Reference

AbstractEventSourcedActor
in package

AbstractYes

Class-based OOP alternative to the functional EventSourcedBehavior API.

Users extend this class and override abstract methods to define their domain logic. The actor delegates to PersistenceEngine::create() for recovery and persistence handling.

Immutable via clone — with* methods return new instances.

Tags
template

The state type

The event type

psalm-api

Table of Contents

Methods

__construct()  : mixed
applyEvent()  : S
Apply an event to the state, returning the new state.
emptyState()  : S
The initial empty state before any events have been applied.
handleCommand()  : Effect
Handle a command and return an Effect describing what should happen.
persistenceId()  : PersistenceId
The unique persistence identity for this actor.
toBehavior()  : Behavior
Build a Behavior by delegating to PersistenceEngine::create().
toProps()  : Props
Build Props from the behavior, ready for spawning.
withReplayFilter()  : static
withRetention()  : static
withSnapshotStore()  : static
withSnapshotStrategy()  : static
withWriterId()  : static

Methods

applyEvent()

Apply an event to the state, returning the new state.

public abstract applyEvent(S $state, E $event) : S
Parameters
$state : S
$event : E
Return values
S

emptyState()

The initial empty state before any events have been applied.

public abstract emptyState() : S
Return values
S

withWriterId()

public withWriterId(Ulid $writerId) : static
Parameters
$writerId : Ulid
Return values
static
On this page

Search results