what is different with Transitions external internal and local ? in Spring doc 11.5 Configuring Transitions
Asked Answered
C

2

11

11.5 Configuring Transitions We support three different types of transitions, external, internal and local. Transitions are either triggered by a signal which is an event sent into a state machine or a timer. I donot konw what is different .

Carbineer answered 6/4, 2019 at 4:41 Comment(0)
M
14

Internal

You can think of internal transition as self-transition - from A to A; Source and target state are always the same.

Local and External

Most of the time these two are equivalent, with the exception of when transitioning between super and sub-states. Local transition doesn’t cause exit and entry to source state if target state is a substate of a source state or if the target is a superstate of a source state.

Please consult the official UML specification (section 14.5.11 - Transition class, especially - Constraints section, where the above is formally defined) upon which the Spring state machine is implemented.

Matless answered 6/4, 2019 at 9:45 Comment(1)
thanks to mention that spring state machine is based on UML specsRusell
M
0

It is really interesting, that the Spring State Machine is modelled upon UML spec. But there is also documentation about the nature of the transitions within the official docs here at https://docs.spring.io/spring-statemachine/docs/current/reference/#transitions

Transitions
A transition is a relationship between a source state and a target state. A switch from one state to another is a state transition caused by a trigger.

Internal Transition
Internal transition is used when an action needs to be run without causing a state transition. In an internal transition, the source state and the target state is always the same, and it is identical with a self-transition in the absence of state entry and exit actions.

External versus Local Transitions
In most cases, external and local transitions are functionally equivalent, except in cases where the transition happens between super and sub states. Local transitions do not cause exit and entry to a source state if the target state is a substate of a source state. Conversely, local transitions do not cause exit and entry to a target state if the target is a superstate of a source state. The following image shows the difference between local and external transitions with very simplistic super and sub states: {here a really good visual explanation follows, which I can not paste, so please follow the link}

Market answered 25/3 at 18:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.