danielgerlag / danielgerlag/workflow-core

Recur does not start again if any process is failed.

Open
#1,063 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
5.9k
Forks
1.3k
Avg merge
1d 1h
Merged PRs (30d)
5

Description

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()" 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()
                            .Then()
                            .Then()
                            .Then()
                            .Then()
                            .Then(c => Console.WriteLine("Trains Processed Successfully"))
                        ).CompensateWith()
                        .Then(c => Console.WriteLine("Trains failed start again"))//recur should be start again.
                     )
                );

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the shown workflow using Recur, ForEach, Saga, OnError, and CompensateWith, with one of Train_1 through Train_5 failing. Trace how the recurrence handles the failed Saga and compensation. Done means the next recurrence starts again from Train_1 after an exception, with the failure status still recorded.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.