trait ChangeEventHandler[Command, State, ChangeEvent] extends AnyRef

API May Change: Implement this interface and use it in DurableStateBehavior#withChangeEventHandler to store additional change event when the state is updated. The event can be used in Projections.

The updateHandler and deleteHandler are invoked after the ordinary command handler. Be aware of that if the state is mutable and modified by the command handler the previous state parameter of the updateHandler will also include the modification, since it's the same instance. If that is a problem you need to use immutable state and create a new state instance when modifying it in the command handler.

Annotations
@ApiMayChange()
Source
ChangeEventHandler.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ChangeEventHandler
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def deleteHandler(previousState: State, command: Command): ChangeEvent

    Store additional change event when the state is updated.

    Store additional change event when the state is updated. The event can be used in Projections.

    previousState

    Previous state before the delete.

    returns

    The change event to be stored.

  2. abstract def updateHandler(previousState: State, newState: State, command: Command): ChangeEvent

    Store additional change event when the state is updated.

    Store additional change event when the state is updated. The event can be used in Projections.

    previousState

    Previous state before the update.

    newState

    New state after the update.

    returns

    The change event to be stored.