-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the Save / Load feature is incomplete and the loaded STM doesn't continue where it was saved #28
Comments
I agree, I'm working on splitting the state from the actual machine, but it's a bit tricky. Hopefully, I'll find time next week to get it running. |
This is really a tricky one. In addition to extracting the state (current-state, history-states, queued events), I'd like to extract the definition from the runtime, too. And both things are subtly connected with each other. |
What do you think about the idea that only a stopped state machine can be saved? Saving a running state machine would result in an exception. |
I agree, the manual Save should be allowed if the machine is stopped. But in my case, running inside IIS, the persistance is a way to have a stateless statemachine and should work even when running, only when a full transition is completed. In my opinion, the manual save and the automatic save for a custom persistance should be separated features. A stateless statemachine should automatically update the persistance when between 2 |
I'll be able to solve this problem after I split the state machine into its three aspects: definition, execution, state. Until then, the best I can offer is the manual Save approach. But I can do that with the option to accept Saves when the machine is running. This isn't checked in the current version anyway. |
Save() doesnt work for me either, and Load() fails also. Why can't there be a simple option to save and load. Doesnt make sense [NullReferenceException: Object reference not set to an instance of an object.] |
@zanek do you use the latest official release or the pre-release? |
I used the latest version. I ended up switching to Stateless, this library was to buggy and incomplete. |
Loading and saving are reworked in version 5.1 and includes now enqueued events. |
Hi and Happy New Year !
I noticed that the events added to the queue aren't Saved and because of that, a new Loaded STM does not continue properly after a Load.
Also, because there is no way to know if the STM is done working (except if manually stopped depending on active / passive implementations) to be saved properly, the Save operation should happen only when the STM is not executing, because an action could fire some events.
The Save operation should wait until the current transition is completed, then save everything including the events queued.
This could be done by calling Stop (stop should wait until completion), then Save and finally Start if the STM was already running.
As I was saying in the issue #21 (comment),
I think a better suited design would be to store the StateMachine's datas in a Model (CurrentState, events queued, HistoryStates etc.) and then use this model with the Persistence implementation.
The text was updated successfully, but these errors were encountered: