Class ReactiveStateMachineExecutor<S,E>
java.lang.Object
org.springframework.statemachine.support.LifecycleObjectSupport
org.springframework.statemachine.support.ReactiveStateMachineExecutor<S,E>
- Type Parameters:
S- the type of stateE- the type of event
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,StateMachineExecutor<S,,E> StateMachineReactiveLifecycle
public class ReactiveStateMachineExecutor<S,E>
extends LifecycleObjectSupport
implements StateMachineExecutor<S,E>
Default reactive implementation of a
StateMachineExecutor.- Author:
- Janne Valkealahti
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.statemachine.support.StateMachineExecutor
StateMachineExecutor.ExecutorExceptionHolder, StateMachineExecutor.MonoSinkStateMachineExecutorCallback, StateMachineExecutor.StateMachineExecutorCallback, StateMachineExecutor.StateMachineExecutorTransit<S,E> -
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionReactiveStateMachineExecutor(StateMachine<S, E> stateMachine, StateMachine<S, E> relayStateMachine, Collection<Transition<S, E>> transitions, Map<Trigger<S, E>, Transition<S, E>> triggerToTransitionMap, List<Transition<S, E>> triggerlessTransitions, Transition<S, E> initialTransition, org.springframework.messaging.Message<E> initialEvent, TransitionConflictPolicy transitionConflictPolicy) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStateMachineInterceptor(StateMachineInterceptor<S, E> interceptor) Adds the state machine interceptor.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for pre start logic.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for pre stop logic.reactor.core.publisher.Mono<Void>executeTriggerlessTransitions(StateContext<S, E> context, State<S, E> state) Execute and check all triggerless transitions.protected voidonInit()Subclasses may implement this for initialization logic.voidqueueDeferredEvent(org.springframework.messaging.Message<E> message) Queue deferred event.reactor.core.publisher.Mono<Void>queueEvent(reactor.core.publisher.Mono<org.springframework.messaging.Message<E>> message, StateMachineExecutor.StateMachineExecutorCallback callback) Queue event.voidsetForwardedInitialEvent(org.springframework.messaging.Message<E> message) Set initial forwarded event.voidsetInitialEnabled(boolean enabled) Sets the if initial stage is enabled.voidsetStateMachineExecutorTransit(StateMachineExecutor.StateMachineExecutorTransit<S, E> stateMachineExecutorTransit) Sets the state machine executor transit.Methods inherited from class org.springframework.statemachine.support.LifecycleObjectSupport
afterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactivelyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
stopMethods inherited from interface org.springframework.statemachine.support.StateMachineReactiveLifecycle
startReactively, stopReactively
-
Constructor Details
-
ReactiveStateMachineExecutor
public ReactiveStateMachineExecutor(StateMachine<S, E> stateMachine, StateMachine<S, E> relayStateMachine, Collection<Transition<S, E>> transitions, Map<Trigger<S, E>, Transition<S, E>> triggerToTransitionMap, List<Transition<S, E>> triggerlessTransitions, Transition<S, E> initialTransition, org.springframework.messaging.Message<E> initialEvent, TransitionConflictPolicy transitionConflictPolicy)
-
-
Method Details
-
onInit
Description copied from class:LifecycleObjectSupportSubclasses may implement this for initialization logic. Called during theInitializingBeanphase.- Overrides:
onInitin classLifecycleObjectSupport- Throws:
Exception- exception
-
doPreStartReactively
Description copied from class:LifecycleObjectSupportSubclasses may implement this for pre start logic.- Overrides:
doPreStartReactivelyin classLifecycleObjectSupport- Returns:
- the mono for completion
-
doPreStopReactively
Description copied from class:LifecycleObjectSupportSubclasses may implement this for pre stop logic.- Overrides:
doPreStopReactivelyin classLifecycleObjectSupport- Returns:
- the mono for completion
-
queueDeferredEvent
Description copied from interface:StateMachineExecutorQueue deferred event.- Specified by:
queueDeferredEventin interfaceStateMachineExecutor<S,E> - Parameters:
message- the message
-
executeTriggerlessTransitions
public reactor.core.publisher.Mono<Void> executeTriggerlessTransitions(StateContext<S, E> context, State<S, E> state) Description copied from interface:StateMachineExecutorExecute and check all triggerless transitions.- Specified by:
executeTriggerlessTransitionsin interfaceStateMachineExecutor<S,E> - Parameters:
context- the state contextstate- the state- Returns:
- completion when handled
-
setInitialEnabled
public void setInitialEnabled(boolean enabled) Description copied from interface:StateMachineExecutorSets the if initial stage is enabled.- Specified by:
setInitialEnabledin interfaceStateMachineExecutor<S,E> - Parameters:
enabled- the new flag
-
setForwardedInitialEvent
Description copied from interface:StateMachineExecutorSet initial forwarded event.- Specified by:
setForwardedInitialEventin interfaceStateMachineExecutor<S,E> - Parameters:
message- the forwarded message- See Also:
-
setStateMachineExecutorTransit
public void setStateMachineExecutorTransit(StateMachineExecutor.StateMachineExecutorTransit<S, E> stateMachineExecutorTransit) Description copied from interface:StateMachineExecutorSets the state machine executor transit.- Specified by:
setStateMachineExecutorTransitin interfaceStateMachineExecutor<S,E> - Parameters:
stateMachineExecutorTransit- the state machine executor transit
-
addStateMachineInterceptor
Description copied from interface:StateMachineExecutorAdds the state machine interceptor.- Specified by:
addStateMachineInterceptorin interfaceStateMachineExecutor<S,E> - Parameters:
interceptor- the interceptor
-
queueEvent
public reactor.core.publisher.Mono<Void> queueEvent(reactor.core.publisher.Mono<org.springframework.messaging.Message<E>> message, StateMachineExecutor.StateMachineExecutorCallback callback) Description copied from interface:StateMachineExecutorQueue event.- Specified by:
queueEventin interfaceStateMachineExecutor<S,E> - Parameters:
message- the messagecallback- the executor callback- Returns:
- completion when event is queued
-