elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

Handling exception inside Workflow Context Provider

Open OvyDev opened this issue 4 years ago • 6 comments

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?

OvyDev avatar Nov 04 '21 10:11 OvyDev

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?

OvyDev avatar Nov 09 '21 14:11 OvyDev

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?

sfmskywalker avatar Nov 22 '21 16:11 sfmskywalker

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.

stale[bot] avatar Jan 21 '22 16:01 stale[bot]

any update ?

Nokecy avatar Jul 30 '22 03:07 Nokecy

@Nokecy thanks for asking, looks like this issue got stale and then closed. No progress has been made as of yet.

sfmskywalker avatar Jul 30 '22 05:07 sfmskywalker

any idea ? @sfmskywalker

Nokecy avatar Aug 05 '22 05:08 Nokecy