Class AbstractPersistentActor

    • Constructor Detail

      • AbstractPersistentActor

        public AbstractPersistentActor()
    • Method Detail

      • createReceive

        public abstract AbstractActor.Receive createReceive()
        An persistent actor has to define its initial receive behavior by implementing the createReceive method, also known as the command handler. Typically validates commands against current state (and/or by communication with other actors). On successful validation, one or more events are derived from a command and these events are then persisted by calling persist.
        Specified by:
        createReceive in interface AbstractPersistentActorLike
        Specified by:
        createReceive in class AbstractActor
      • createReceiveRecover

        public abstract AbstractActor.Receive createReceiveRecover()
        Recovery handler that receives persisted events during recovery. If a state snapshot has been captured and saved, this handler will receive a SnapshotOffer message followed by events that are younger than the offered snapshot.

        This handler must not have side-effects other than changing persistent actor state i.e. it should not perform actions that may fail, such as interacting with external services, for example.

        If there is a problem with recovering the state of the actor from the journal, the error will be logged and the actor will be stopped.

        Specified by:
        createReceiveRecover in interface AbstractPersistentActorLike
        See Also:
        Recovery