S
- the type of stateE
- the type of eventT
- the type of persister context objectpublic abstract class AbstractPersistingStateMachineInterceptor<S,E,T> extends StateMachineInterceptorAdapter<S,E> implements StateMachinePersist<S,E,T>
StateMachineInterceptor
persisting StateMachineContext
s.
This class is to be used as a base implementation which wants to persist a machine which
is about to kept running as normal use case for persistence is to stop machine, persist and
then start it again.Constructor and Description |
---|
AbstractPersistingStateMachineInterceptor() |
Modifier and Type | Method and Description |
---|---|
protected StateMachineContext<S,E> |
buildStateMachineContext(StateMachine<S,E> stateMachine,
StateMachine<S,E> rootStateMachine,
State<S,E> state)
Deprecated.
|
protected StateMachineContext<S,E> |
buildStateMachineContext(StateMachine<S,E> stateMachine,
StateMachine<S,E> rootStateMachine,
State<S,E> state,
org.springframework.messaging.Message<E> message)
Builds the state machine context.
|
void |
postStateChange(State<S,E> state,
org.springframework.messaging.Message<E> message,
Transition<S,E> transition,
StateMachine<S,E> stateMachine,
StateMachine<S,E> rootStateMachine)
Called after a state change.
|
void |
preStateChange(State<S,E> state,
org.springframework.messaging.Message<E> message,
Transition<S,E> transition,
StateMachine<S,E> stateMachine,
StateMachine<S,E> rootStateMachine)
Called prior of a state change.
|
abstract StateMachineContext<S,E> |
read(T contextObj)
Read
StateMachineContext from persistent store. |
void |
setExtendedStateVariablesFunction(Function<StateMachine<S,E>,java.util.Map<java.lang.Object,java.lang.Object>> extendedStateVariablesFunction)
Sets the function creating extended state variables.
|
abstract void |
write(StateMachineContext<S,E> context,
T contextObj)
Write
StateMachineContext into persistent store. |
postTransition, preEvent, preTransition, stateMachineError
public AbstractPersistingStateMachineInterceptor()
public void preStateChange(State<S,E> state, org.springframework.messaging.Message<E> message, Transition<S,E> transition, StateMachine<S,E> stateMachine, StateMachine<S,E> rootStateMachine)
StateMachineInterceptor
preStateChange
in interface StateMachineInterceptor<S,E>
preStateChange
in class StateMachineInterceptorAdapter<S,E>
state
- the statemessage
- the messagetransition
- the transitionstateMachine
- the state machinerootStateMachine
- the root state machinepublic void postStateChange(State<S,E> state, org.springframework.messaging.Message<E> message, Transition<S,E> transition, StateMachine<S,E> stateMachine, StateMachine<S,E> rootStateMachine)
StateMachineInterceptor
postStateChange
in interface StateMachineInterceptor<S,E>
postStateChange
in class StateMachineInterceptorAdapter<S,E>
state
- the statemessage
- the messagetransition
- the transitionstateMachine
- the state machinerootStateMachine
- the root state machinepublic abstract void write(StateMachineContext<S,E> context, T contextObj) throws java.lang.Exception
StateMachineContext
into persistent store.write
in interface StateMachinePersist<S,E,T>
context
- the state machine contextcontextObj
- the context objectjava.lang.Exception
- the exceptionpublic abstract StateMachineContext<S,E> read(T contextObj) throws java.lang.Exception
StateMachineContext
from persistent store.read
in interface StateMachinePersist<S,E,T>
contextObj
- the context objectjava.lang.Exception
- the exceptionpublic void setExtendedStateVariablesFunction(Function<StateMachine<S,E>,java.util.Map<java.lang.Object,java.lang.Object>> extendedStateVariablesFunction)
extendedStateVariablesFunction
- the extended state variables functionprotected StateMachineContext<S,E> buildStateMachineContext(StateMachine<S,E> stateMachine, StateMachine<S,E> rootStateMachine, State<S,E> state)
buildStateMachineContext(StateMachine, StateMachine, State, Message)
StateMachineContext
.
Implementor of this class, if using this method should move over to
buildStateMachineContext(StateMachine, StateMachine, State, Message)
.stateMachine
- the state machinerootStateMachine
- the root state machinestate
- the stateprotected StateMachineContext<S,E> buildStateMachineContext(StateMachine<S,E> stateMachine, StateMachine<S,E> rootStateMachine, State<S,E> state, org.springframework.messaging.Message<E> message)
stateMachine
- the state machinerootStateMachine
- the root state machinestate
- the statemessage
- the message