简体   繁体   中英

Stateless framework work with indepedent Forks?

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:

当前状态机

Sorry if you don't understand.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM