Skip to content

Step execution order after Branch is completed #1357

Description

@lazarkadic

Describe the bug
If there is a registered step after .Decide step in a workflow, flow of execution is not as expected. If you add step after .Decide step, that step is executed right after first step from one of the branches, and not after whole branch is completed. How can I continue workflow after .Decide step?

To Reproduce
Add Step after .Decide step and start the workflow.

var branch1 = builder.CreateBranch()
    .StartWith<PrintMessage>()
        .Input(step => step.Message, data => "hi from 1")
    .Then<PrintMessage>()
        .Input(step => step.Message, data => "bye from 1");

var branch2 = builder.CreateBranch()
    .StartWith<PrintMessage>()
        .Input(step => step.Message, data => "hi from 2")
    .Then<PrintMessage>()
        .Input(step => step.Message, data => "bye from 2");


builder
    .StartWith<HelloWorld>()
    .Decide(data => data.Value1)
        .Branch((data, outcome) => data.Value1 == "one", branch1)
        .Branch((data, outcome) => data.Value1 == "two", branch2)
    .Then<PrintMessage>()
        .Input(step => step.Message, data => "Should be executed at the end.");

Expected behavior
Expected behavior if data.Value1 is set to "two":

  • Expected output:
Hello
hi from 2
bye from 2
Should be executed at the end.
  • Actual output:
Hello
hi from 2
Should be executed at the end.
bye from 2

Additional context
Screenshots:

Image

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions