Interface Region<S,E>
- Type Parameters:
S- the type of stateE- the type of event
- All Superinterfaces:
StateMachineReactiveLifecycle
- All Known Subinterfaces:
StateMachine<S,E>
- All Known Implementing Classes:
AbstractStateMachine,DistributedStateMachine,ObjectStateMachine
A region is an orthogonal part of either a composite state or a state
machine. It contains states and transitions.
- Author:
- Janne Valkealahti
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddStateListener(StateMachineListener<S, E> listener) Adds the state listener.getId()Gets the region and state machine id.getState()Gets the currentState.Collection<State<S,E>> Gets theStates defined in this region.Gets aTransitions for this region.getUuid()Gets the region and state machine unique id.booleanChecks if region complete.voidremoveStateListener(StateMachineListener<S, E> listener) Removes the state listener.booleanDeprecated.booleanDeprecated.in favor ofsendEvent(Mono)reactor.core.publisher.Flux<StateMachineEventResult<S,E>> reactor.core.publisher.Mono<List<StateMachineEventResult<S,E>>> sendEventCollect(reactor.core.publisher.Mono<org.springframework.messaging.Message<E>> event) reactor.core.publisher.Flux<StateMachineEventResult<S,E>> sendEvents(reactor.core.publisher.Flux<org.springframework.messaging.Message<E>> events) voidstart()Deprecated.in favor ofStateMachineReactiveLifecycle.startReactively()voidstop()Deprecated.in favor ofStateMachineReactiveLifecycle.stopReactively()Methods inherited from interface org.springframework.statemachine.support.StateMachineReactiveLifecycle
startReactively, stopReactively
-
Method Details
-
getUuid
UUID getUuid()Gets the region and state machine unique id.- Returns:
- the region and state machine unique id
-
getId
String getId()Gets the region and state machine id. This identifier is provided for users disposal and can be set from a various ways to build a machines.- Returns:
- the region and state machine id
-
start
Deprecated.in favor ofStateMachineReactiveLifecycle.startReactively()Start the region. -
stop
Deprecated.in favor ofStateMachineReactiveLifecycle.stopReactively()Stop the region. -
sendEvent
Deprecated.in favor ofsendEvent(Mono)Send an eventEwrapped with aMessageto the region.NOTE: this method is now deprecated in favour of a reactive methods.
- Parameters:
event- the wrapped event to send- Returns:
- true if event was accepted
-
sendEvent
Deprecated.in favor ofsendEvent(Mono)Send an eventEto the region.NOTE: this method is now deprecated in favour of a reactive methods.
- Parameters:
event- the event to send- Returns:
- true if event was accepted
-
sendEvents
reactor.core.publisher.Flux<StateMachineEventResult<S,E>> sendEvents(reactor.core.publisher.Flux<org.springframework.messaging.Message<E>> events) Send aFluxof events and return aFluxofStateMachineEventResults. Events are consumed after returned results are consumed.- Parameters:
events- the events- Returns:
- the event results
-
sendEvent
reactor.core.publisher.Flux<StateMachineEventResult<S,E>> sendEvent(reactor.core.publisher.Mono<org.springframework.messaging.Message<E>> event) Send aMonoof event and return aFluxofStateMachineEventResults. Events are consumed after returned results are consumed.- Parameters:
event- the event- Returns:
- the event results
-
sendEventCollect
reactor.core.publisher.Mono<List<StateMachineEventResult<S,E>>> sendEventCollect(reactor.core.publisher.Mono<org.springframework.messaging.Message<E>> event) Send aMonoof event and return aMonoof collectedStateMachineEventResults as a list. Events are consumed after returned results are consumed.- Parameters:
event- the event- Returns:
- the event results
-
getState
Gets the currentState.- Returns:
- current state
-
getStates
Collection<State<S,E>> getStates()Gets theStates defined in this region. Returned collection is an unmodifiable copy because states in a state machine are immutable.- Returns:
- immutable copy of states
-
getTransitions
Collection<Transition<S,E>> getTransitions()Gets aTransitions for this region.- Returns:
- immutable copy of transitions
-
isComplete
boolean isComplete()Checks if region complete. Region is considered to be completed if it has reached its end state and no further event processing is happening.- Returns:
- true, if complete
-
addStateListener
Adds the state listener.- Parameters:
listener- the listener
-
removeStateListener
Removes the state listener.- Parameters:
listener- the listener
-
sendEvent(Mono)