我正在努力坚持我的状态机遵循可用的配方和示例。我正在使用主分支,我的状态机使用分层状态,区域和正交状态。我遵循的第一个例子是spring-statemachine-samples/persist,但似乎只涉及基本的FSM。我尝试的第二个是LocalStateMachineInterceptor但是id似乎不适用于Hierarchical States。此外,我无法通过StateMachinePersist
找到任何方法来保持历史状态。
是否存在具有持久性的复杂FSM的示例?
答案 0 :(得分:0)
I have to be honest that persistence is one relatively unknown topic for samples and docs when things gets more complicated. It is something I'm currently working on to make it easier because as a user you should not care as there should be a relatively clean API's to do it. So stay tuned for those.
Having said that, before we get code more clear on this;
StateMachinePersist
leads to StateMachineContext
and there is some code in tests, namely StateMachineResetTests which shows some ways to do these things. There was also a question gh127 where I wrote something about internals of resetting a machine which is what a persistence does.
History state, yes that's my bad, for some reason it has slipped from my radar. Thanks for pointing it out! Created an issue for it gh182.