We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I need to excute three methods in parallel but the following code excute it in sequential order. Kindly help me to sort the issue.
Also, tried WaitFor & Delay they didn't work as expected. They are waiting for the first branch to finish.
public class WorkFlow_BusinessService : IWorkflow<InputData> { public string Id => "Step1"; public int Version => 1; public void Build(IWorkflowBuilder<InputData> builder) { builder .Parallel() .Do(then => then.StartWith<Data1>() .Input(step => step.inputObj, data => data) .Output((step, data) => step.OutputObj)) .Do(then => then.StartWith<Data2>() .Input(step => step.inputObj, data => data) .Output((step, data) => step.OutputObj) .Then<Data2A>() .Input(step => step.inputObj, data => data) .Output((step, data) => step.OutputObj)) .Do(then => then.StartWith<Data3>() .Input(step => step.inputObj, data => data) .Output((step, data) => step.OutputObj)) .Join(); } } public class Data1 : StepBody { public InputData inputObj { get; set; } public InputData OutputObj { get; set; } public override ExecutionResult Run(IStepExecutionContext context) { Console.WriteLine("Data1 Started at " + DateTime.Now.ToString()); OutputObj = // Internal Method Console.WriteLine("Data1 Completed at " + DateTime.Now.ToString()); return ExecutionResult.Next(); } }
Output Data1 started at 1/3/2024 15:09:28 Data1 Completed at 1/3/2024 15:09:29
Data2 started at 1/3/2024 15:09:29 Data2 Completed at 1/3/2024 15:09:31
Data2A started at 1/3/2024 15:09:34 Data2A Completed at 1/3/2024 15:09:37
Data3 started at 1/3/2024 15:09:31 Data3 Completed at 1/3/2024 15:09:34
Expected Output
Data1 started at 1/3/2024 15:09:28 Data1 Completed at 1/3/2024 15:09:29
Data2 started at 1/3/2024 15:09:28 Data2 Completed at 1/3/2024 15:09:30
Data2A started at 1/3/2024 15:09:30 Data2A Completed at 1/3/2024 15:09:33
Data3 started at 1/3/2024 15:09:28 Data3 Completed at 1/3/2024 15:09:31
The text was updated successfully, but these errors were encountered:
Hi, For long running steps you should consider using thing like :
var taskId = context.PersistenceData; if(taskId==null){ taskId = StartLongRunningTask(); return ExecutionResult.Sleep( 500, taskId); } var status = GetLongRunningTaskStatus(taskId); switch(status) { case "OK": return ExecutionResult.Next( ); case "Running": return ExecutionResult.Sleep( 500, taskId); }
because next step won't be launched until current step Run method returns.
Sorry, something went wrong.
I am facing the same issue here, even for the Sample09 the soure code provides works in sequence, have u solved the problem yet?
No branches or pull requests
Hi,
I need to excute three methods in parallel but the following code excute it in sequential order. Kindly help me to sort the issue.
Also, tried WaitFor & Delay they didn't work as expected. They are waiting for the first branch to finish.
Output
Data1 started at 1/3/2024 15:09:28
Data1 Completed at 1/3/2024 15:09:29
Data2 started at 1/3/2024 15:09:29
Data2 Completed at 1/3/2024 15:09:31
Data2A started at 1/3/2024 15:09:34
Data2A Completed at 1/3/2024 15:09:37
Data3 started at 1/3/2024 15:09:31
Data3 Completed at 1/3/2024 15:09:34
Expected Output
Data1 started at 1/3/2024 15:09:28
Data1 Completed at 1/3/2024 15:09:29
Data2 started at 1/3/2024 15:09:28
Data2 Completed at 1/3/2024 15:09:30
Data2A started at 1/3/2024 15:09:30
Data2A Completed at 1/3/2024 15:09:33
Data3 started at 1/3/2024 15:09:28
Data3 Completed at 1/3/2024 15:09:31
The text was updated successfully, but these errors were encountered: