spring-projects / spring-statemachine

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

Parallel loading of new sub machine at runtime programmatically #1100

Open immannan opened 1 year ago

immannan commented 1 year ago

Hi, I want to programmatically create new submachines at runtime based on the defined and loaded submachine states region. These submachines will be created and loaded after the first state change of the parent statemachine.

Here is the state config.

states
      .withStates()
          .initial(States.A)
          .state(States.B)
          .and()
          .withStates()
              .parent(States.B)
              .initial(States.B1)
              .state(States.B1)
              .state(States.B2);
          state(States.C)

Now what I want is to create submachine from the region#1 at runtime having their unique UUID and Id and linked to the parent statemachine region

The data flow event would be something like this.

Parent Statemachine - State A, B SubMachine#1 - State B1, B2 SubMachine#2 - State B1, B2 SubMachine#3 - State B1, B2 Parent Statemachine - State C

I have gone through the docs but didn't find anything. Is this possible in spring state machine?