Reputation: 343
We are using Elsa 2.12 for workflow support in our approval processes and we want to be able to recover faulted workflows. I have tried following the advice provided here but I have my doubts about what version of Elsa it is applicable to and also despite my best efforts, I have not been able to succeed.
The discussion at the link suggests to set the faulted activity as blocking and set the workflow instance as suspended, which I did, but it did not help. I also tried setting the faulted activity as a scheduled activity (rather than blocking) and using a different overall workflow status, but to no avail as well.
Finally, out of desperation, I have also tried to set breakpoints all across the WorkflowInstanceStore
(as well as components that appeared to handle workflow launching/resuming) in Rider to see which method gets triggered during startup so that the recovered workflow instance can get picked up by Elsa and acted upon, but funny enough, no WF instance store method did. I am not entirely sure that those breakpoints worked correctly but then again, they did work when I sent a request to create a new workflow instance.
So my question is, how do we actually recover a faulted workflow and make Elsa 2 take note and resume the workflow from the given point of resumption.
Thanks in advance for any insight.
Upvotes: 0
Views: 442
Reputation: 343
Eventually figured out a way to handle this. Contrary to the suggestion in the link in my original post, my solution involved
Idle
rather than Suspended
since Elsa didn't like it if the faulted activity was not a blocking one.Faults
stack of the workflow instance. My experiments showed that if the fault record was kept there, the workflow instance would get marked as Faulted
once again as soon as it completed execution. Just to be sure, I also reset the FaultedAt
timestamp.IWorkflowInstanceStore
. I am not sure if this step was entirely necessary but I wanted to be sure my update got persisted before the workflow instance got resumed.IWorkflowInstanceExecutor
instance to ask Elsa to resume execution of the recovered workflow instance. Since this method also takes the id of the activity from which execution is supposed to be resumed, I did not have to add it to the ScheduledActivities
stack of the workflow instance.Upvotes: 0