2.5 KiB
Workflow Basics
This tutorial covers the fundamentals of authoring Dapr Workflows. For more information about the fundamentals of Dapr Workflows, see the Dapr docs.
Inspect the code
Open the BasicWorkflow.cs
file in the tutorials/workflow/csharp/fundamentals/Basic
folder. This file contains the definition for the workflow.
The workflow consists of two activities: Activity1
and Activity2
, which are called in sequence, where the result of Activity1 is used as an input for Activity2. You can find the Activity definitions in the Activities
folder.
graph LR
SW((Start
Workflow))
A1[Activity1]
A2[Activity2]
EW((End
Workflow))
SW --> A1
A1 --> A2
A2 --> EW
Run the tutorial
-
Use a terminal to navigate to the
tutorials/workflow/csharp/fundamentals
folder. -
Build the project using the .NET CLI.
dotnet build ./Basic/
-
Use the Dapr CLI to run the Dapr Multi-App run file
```bash
dapr run -f .
<!-- END_STEP -->
-
Use the POST request in the
fundamentals.http
file to start the workflow, or use this cURL command:curl -i --request POST http://localhost:5254/start/One
Note the
Location
header in the response. This header contains the workflow instance ID. You can use this ID to get the status of the workflow instance you just started.The input for the workflow is a string with the value
One
. The expected app logs are as follows:== APP - basic == Activity1: Received input: One. == APP - basic == Activity2: Received input: One Two.
-
Use the GET request in the
fundamentals.http
file to get the status of the workflow, or use this cURL command:curl --request GET --url http://localhost:3554/v1.0/workflows/dapr/<INSTANCEID>
Where
<INSTANCEID>
is the workflow instance ID you received in theLocation
header in the previous step.The expected serialized output of the workflow is:
"\"One Two Three\""
-
Stop the Dapr Multi-App run process by pressing
Ctrl+C
.