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 TypeMethodDescriptionvoid
addStateListener
(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 theState
s defined in this region.Gets aTransition
s for this region.getUuid()
Gets the region and state machine unique id.boolean
Checks if region complete.void
removeStateListener
(StateMachineListener<S, E> listener) Removes the state listener.boolean
Deprecated.boolean
Deprecated.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) void
start()
Deprecated.in favor ofStateMachineReactiveLifecycle.startReactively()
void
stop()
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 eventE
wrapped with aMessage
to 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 eventE
to 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 aFlux
of events and return aFlux
ofStateMachineEventResult
s. 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 aMono
of event and return aFlux
ofStateMachineEventResult
s. 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 aMono
of event and return aMono
of collectedStateMachineEventResult
s 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 theState
s 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 aTransition
s 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)