Interface ChangeEventHandler<Command,State,ChangeEvent>
-
public interface ChangeEventHandler<Command,State,ChangeEvent>API May Change: Implement this interface and use it inDurableStateBehavior#withChangeEventHandlerto store additional change event when the state is updated. The event can be used in Projections.The
updateHandleranddeleteHandlerare 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 theupdateHandlerwill 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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChangeEventdeleteHandler(State previousState, Command command)Store additional change event when the state is updated.ChangeEventupdateHandler(State previousState, State newState, Command command)Store additional change event when the state is updated.
-
-
-
Method Detail
-
updateHandler
ChangeEvent updateHandler(State previousState, State newState, Command command)
Store additional change event when the state is updated. The event can be used in Projections.- Parameters:
previousState- Previous state before the update.newState- New state after the update.- Returns:
- The change event to be stored.
-
deleteHandler
ChangeEvent deleteHandler(State previousState, Command command)
Store additional change event when the state is updated. The event can be used in Projections.- Parameters:
previousState- Previous state before the delete.- Returns:
- The change event to be stored.
-
-