2

We are thinking about adopt state machine Stateless Framework in our system but we have a requirement that I didn't understand yet if the Stateless framework can help or if will add complexity to our system.

Why change? Because the system is growing and have some dependencies between each state machine that we want remove. Also, use an open source and well structured framework is always better that makes a new one.

Example: We have a state non deterministic machine [SM_A] that forks in [n] new state machines [SM_B]. The last state of [SM_A] is dependent of all the [SM_B] forks. Each fork, join to the SM_A when the work is over, inform him to verify if all the SM_B's are finished. When all the forks finish the SM_A will continue. Also, all the states need to be persisted, because at the moment we wait for a action to "wake up" all the forks [SM_B]s.

(Pseudostates : http://www.uml-diagrams.org/state-machine-diagrams.html#fork-pseudostate )

The image below illustrates the flow:

Current state machine

Sorry if you don't understand.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
andre
  • 113
  • 1
  • 10

1 Answers1

1

Stateless does not support forks, as I understand them. But I think Stateless can be used to solve your problem. Maybe SM_A can be used to instantiate n number of SM_B objects. SM_A keeps track of all the SM_Bs, and each SM_B lets SM_A know it has done its job. When SM_A notices that all SM_B have completed it will transition to the SM_A_5 state.

HenningNT
  • 183
  • 8
  • Thanks. Yep, we are trying to change the responsability of SM management from child to parent... So the parent (SM_A) knows all the children (SM_B). – andre Mar 15 '17 at 11:18
  • Also we are testing the Automatonymous. – andre Mar 15 '17 at 11:20
  • 1
    Looking at your diagram, you seem to be building a job processor, you may also want to take a look at REstate a library I created from some of Stateless's ideas, but with a focus on portable state machines. https://github.com/psibr/REstate – AIDA Dec 24 '17 at 13:47