workflow-core
workflow-core copied to clipboard
Recur does not start again if any process is failed.
Hi @danielgerlag / Daniel,
I am facing the issue in the below scenario. In the code below, I am using Recure+ForEach+Saga. The code below works fine if an exception does not occur. in any step(train1 to train5), but if any train fails or occurs exception of any step(train1 to train5) , after that recur() function does not start again, processing stops.
Expected scenario : If any exception occurs " .Then(train1) to Then(Train5)", then recure should not be stopped, recur should continue the recur process again.
Note : I have tried to use the OnError() function but this function does not work for me, so I used ".CompensateWith<TracStatusTrainFailedStep>()" and tried to log the failed scenario into the DB. After that, I expect Recur() function start again and start the process again from step(train1).op
builder .StartWith(c => Console.WriteLine("Workflow started")) .Recur(data => TimeSpan.FromSeconds(60), data => false) .Do(r => r .StartWith(c => Console.WriteLine("Processing every min")) .ForEach(f => GetAllTrainList() ) .Do(m => m .Saga(s => s .StartWith(c => Console.WriteLine("Trains Processing Started")) .Then<Train_1>() .Then<Train_2>() .Then<Train_3>() .Then<Train_4>() .Then<Train_5>() .Then(c => Console.WriteLine("Trains Processed Successfully")) ).CompensateWith<SetStatusTrainFailedStep>() .Then(c => Console.WriteLine("Trains failed start again"))//recur should be start again. ) );