I'm new to State machine. Could you explain, it's possible to create dynamic sub-states (pseudo states) in @Configuration classes with application context, or it's possible only by Builder?
For example: I have initial state READY, fork state FORK, parent state TASK and several sub-task states, the number of which is dynamic (T1-T1E, T2-T2E, ...). Sub tasks are executed in parallel.
@Override
public void configure(StateMachineStateConfigurer<States, Events> states)
throws Exception {
states
.withStates()
.initial(States.READY)
.fork(States.FORK)
.state(States.TASKS)
.join(States.JOIN)
.state(States.ERROR)
.and()
.withStates()
.parent(States.TASKS)
.initial(States.T1)
.end(States.T1E)
.and()
.withStates()
.parent(States.TASKS)
.initial(States.T2)
.end(States.T2E)
.and()
.withStates()
.parent(States.TASKS)
.initial(States.T3)
.end(States.T3E)
.and()
....
// dynamic sub-task
....
}
In a moment when State machine hasn't started I have no information, how many sub-states (sub tasks T1-T1E....)I have to create. I will get this information, when be on FORK state. How to configure that in Spring context?
I've found an example when configuration was creating by Builder, outside the Spring application context.
If you know how to do that in Spring context, I will be grateful for your help.