How to do I re-invoke when loading from snapshot? #5258
Replies: 2 comments
-
Promises are not reinvoked by default since that may not be desired behavior. For now, the best approach would be to record and replay events. I'll try to write that up soon, but you can use the inspect API to record events. |
Beta Was this translation helpful? Give feedback.
-
@davidkpiano - You mean, when the machine starts, I persiste the events send, and when restoring - I replay them, so that each action and invocation is re-triggered? Can you clarify what the docs meant by "Invocations will be restarted"? https://stately.ai/docs/persistence
|
Beta Was this translation helpful? Give feedback.
-
I store snapshot when the state changes in an sqlite db.
One of my state has an invoke, and when onDone that moves it to another state.
I want to handle the case where the invoke didn't manage to complete, and the system restarted.
So we load the snapshot from the DB - which seems to have my invoke, but it doesn't run!
This is how I define invoke
This is the json value loaded to when the actor starts.
What I noticed was that when transitioning into the state, I get the function to run, but when loading the snapshot - it does not.
Beta Was this translation helpful? Give feedback.
All reactions