elsa-core
elsa-core copied to clipboard
Handling exception inside Workflow Context Provider
How do Elsa handle exception inside SaveAsync / LoadAsync method in WorkflowContextProvider ?
I was trying to leverage workflow context as in the guide: load workflow context at the beginning, manipulate workflow context inside activity execution, and then save workflow context. What happens if exception was thrown when saving?
So it seems to me Elsa will retry several times and workflow status when idle. What actually happens when a workflow is idle? Will it retries again after sometime ? Or is there any API to continue/manually retry or modify this behavior?
That's a great question. I just looked into it, and it turns out there is no error handling whatsoever. Which is potentially a big issue, depending on what part is invoking the workflow.
For example, if the workflow is triggered via HTTP, no harm is done - the request will fail with an HTTP 500 - Internal Server Error.
But when a workflow is triggered from a message consumer, the consumer will be invoked repeatedly, depending on the retry policy in place.
So I think what we should do is add exception handling that puts the workflow in a faulted state. If a user wants to prevent that from happening, they can implement their own try/catch handler within their workflow context provider and e.g. retry the operation using a retry policy.
Thoughts?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
any update ?
@Nokecy thanks for asking, looks like this issue got stale and then closed. No progress has been made as of yet.
any idea ? @sfmskywalker