Replies: 1 comment
-
This is by design: the This allows you to do things like waiting for some user input in one branch, but continue with another branch after some timeout event. A good example of this scenario is described here. To implement your workflow, all you need is this: public class SimpleForkWorkflow : IWorkflow
{
public void Build(IWorkflowBuilder builder)
{
builder
.WriteLine("This demonstrates a simple workflow with switch.")
.WriteLine("Using switch we can branch a workflow.")
.Then<ForkBranchDecisionActivity>(fork =>
{
fork.When("A")
.WriteLine("You are in A branch. First line")
.WriteLine("You are in A branch. Second line.")
.ThenNamed("Finish");
fork.When("B")
.WriteLine("You are in B branch. First line")
.WriteLine("You are in B branch. Second line.")
.ThenNamed("Finish");
})
.WriteLine("Workflow finished.").WithName("Finish");
}
} Notice that the When you run this workflow, the outcome will be as expected:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Posted this same question here on SO as well .
Looks like I am missing something trivial here.
Elsa is executing both the branches of the workflow, when I am expecting only one, either A or B. Here are the files for console app.
I have pushed the full example here as well .
When I type 'A', the outcome will be 'A', else it will be 'B'.
Is the branch chosen not based on the outcome of the previous activity? If not then what determines the branch to be executed? How come both branches are executed in my case? I tried figuring this out from the examples here but could not.
My final console output looks as follows.
As you can see its executing both the branches. What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions