quickstarts/tutorials/workflow/csharp/child-workflows
Marc Duiker 29443b093e
Add mechanical markdown
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>
2025-04-15 14:26:23 +02:00
..
ChildWorkflows Use file based namespaces, make classes internal sealed 2025-04-01 12:30:07 +01:00
README.md Add mechanical markdown 2025-04-15 14:26:23 +02:00
childworkflows.http Update folder structure 2025-03-21 16:52:43 +01:00
dapr.yaml Fix paths for multi-app run 2025-04-01 13:35:07 +01:00

README.md

Child Workflows

This tutorial demonstrates how a workflow can call child workflows that are part of the same application. Child workflow can be used to break up large workflows into smaller, re-usable parts. For more information about child workflows see the Dapr docs.

Inspect the code

Open the ParentWorkflow.cs file in the tutorials/workflow/csharp/child-workflows/ChildWorkflows folder. This file contains the definition for the workflow.

The workflow iterates over the input array and schedules the ChildWorkflow for each of the input elements. The ChildWorkflow contains a sequence of two activities.

Parent workflow

graph LR
   SW((Start
   Workflow))
   subgraph for each word in the input
    GWL[Call child workflow]
   end
   ALL[Wait until all tasks
   are completed]
   EW((End
   Workflow))
   SW --> GWL
   GWL --> ALL
   ALL --> EW

Child workflow

graph LR
   SW((Start
   Workflow))
   A1[Activity1]
   A2[Activity2]
   EW((End
   Workflow))
   SW --> A1
   A1 --> A2
   A2 --> EW

Run the tutorial

  1. Use a terminal to navigate to the tutorials/workflow/csharp/child-workflows folder.

  2. Build the project using the .NET CLI.

    dotnet build ./ChildWorkflows/
    
  3. Use the Dapr CLI to run the Dapr Multi-App run file

    ```bash
    

    dapr run -f .

    <!-- END_STEP -->
    
    
  4. Use the POST request in the childworkflows.http file to start the workflow.

    The input of the workflow is an array with two strings:

    [
        "Item 1",
        "Item 2"
    ]
    
  5. Use the GET request in the childworkflows.http file to get the status of the workflow.

    The expected serialized output of the workflow is an array with two strings:

    "[\"Item 1 is processed as a child workflow.\",\"Item 2 is processed as a child workflow.\"]"
    
  6. Stop the Dapr Multi-App run process by pressing Ctrl+C.