spring-projects / spring-statemachine

Spring Statemachine is a framework for application developers to use state machine concepts with Spring.
1.54k stars 604 forks source link

spring-statemachine support skip state? #965

Closed Alexhuihui closed 3 years ago

Alexhuihui commented 3 years ago

eg: A -> B -> C -> D,A -> C -> D. The difference mentioned above are A -> B and A -> C, judgment condition is event. The spring-statemachine support that?

Donquih0te commented 3 years ago

It could be performed something like this:

.withExternal()
      .source(State.A)
      .event(Event_1)
      .target(State.B)
      .and()
.withExternal()
      .source(State.A)
      .event(Event_2)
      .target(State.C)
      .and()
jvalkeal commented 3 years ago

If you can't change event itself, then one other option is to use choice where you can setup guards to pick path dynamically.