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

How to properly terminate workflow when using ISyncWorkflowRunner.RunWorkflowSync?

Open chester89 opened this issue 4 years ago • 4 comments

Hello. I'm running workflows from inside ASP.NET Core app - launching it via ISyncWorkflowRunner.RunWorkflowSync and noticed some strange behaviour:

  • I assumed that builder.StartWith<Step1>().OnError(WorkflowErrorHandling.Terminate) will end workflow execution and throw an error you had inside a step. however, next steps are still running
  • I tried providing workflowHost.OnError handler (throwing exception from there) - that didn't stop workflow execution either when one of my steps failed

The reason I'm using ISyncWorkflowRunner is because I need to send workflow results back to the client. What I'd like is a way to say (perhaps for all my workflows) - "if there's an exception inside my step, please don't run the workflow further, let the app know". What is the proper way to achieve such behaviour?

chester89 avatar Sep 29 '20 12:09 chester89