Persist recipe is a simple utility which allows to use a single state machine instance to persist and update a state of an arbitrary item in a repository.
Recipes main class is PersistStateMachineHandler
which assumes user
to do three different things:
StateMachine<String, String>
needs to be used
with a PersistStateMachineHandler
. States and Events are required
to be type of Strings.
PersistStateChangeListener
need to be registered with handler
order to react to persist request.
handleEventWithState
is used to orchestrate state changes.
There is a sample demonstrating usage of this recipe at Chapter 40, Persist.