object EventSourcedBehavior

Source
EventSourcedBehavior.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EventSourcedBehavior
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type CommandHandler[Command, Event, State] = (State, Command) => Effect[Event, State]

    Type alias for the command handler function that defines how to act on commands.

    Type alias for the command handler function that defines how to act on commands.

    The type alias is not used in API signatures because it's easier to see (in IDE) what is needed when full function type is used. When defining the handler as a separate function value it can be useful to use the alias for shorter type signature.

  2. type EventHandler[State, Event] = (State, Event) => State

    Type alias for the event handler function for updating the state based on events having been persisted.

    Type alias for the event handler function for updating the state based on events having been persisted.

    The type alias is not used in API signatures because it's easier to see (in IDE) what is needed when full function type is used. When defining the handler as a separate function value it can be useful to use the alias for shorter type signature.

Value Members

  1. def apply[Command, Event, State](persistenceId: PersistenceId, emptyState: State, commandHandler: (State, Command) => Effect[Event, State], eventHandler: (State, Event) => State): EventSourcedBehavior[Command, Event, State]

    Create a Behavior for a persistent actor.

    Create a Behavior for a persistent actor.

    persistenceId

    stable unique identifier for the event sourced behavior

    emptyState

    the intial state for the entity before any events have been processed

    commandHandler

    map commands to effects e.g. persisting events, replying to commands

    eventHandler

    compute the new state given the current state when an event has been persisted

  2. def currentMetadata[M](context: ActorContext[_])(implicit arg0: ClassTag[M]): Option[M]

    The metadata of the given type that was persisted with an event, if any.

    The metadata of the given type that was persisted with an event, if any. Can only be called from inside the event handler or RecoveryCompleted of an EventSourcedBehavior.

  3. def lastSequenceNumber(context: ActorContext[_]): Long

    The last sequence number that was persisted, can only be called from inside the handlers of an EventSourcedBehavior

  4. def withEnforcedReplies[Command, Event, State](persistenceId: PersistenceId, emptyState: State, commandHandler: (State, Command) => ReplyEffect[Event, State], eventHandler: (State, Event) => State): EventSourcedBehavior[Command, Event, State]

    Create a Behavior for a persistent actor that is enforcing that replies to commands are not forgotten.

    Create a Behavior for a persistent actor that is enforcing that replies to commands are not forgotten. Then there will be compilation errors if the returned effect isn't a , which can be created with , , , or EffectBuilder.thenNoReply.

  5. object CommandHandler

    The CommandHandler defines how to act on commands.

    The CommandHandler defines how to act on commands. A CommandHandler is a function:

    (State, Command) => Effect[Event, State]

    The CommandHandler#command is useful for simple commands that don't need the state and context.