You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: examples/README.md
+78-2Lines changed: 78 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,16 +14,92 @@ All the examples assume that you have a Durable Task-compatible sidecar running
14
14
durabletask-go --port 4001
15
15
```
16
16
17
-
## Running the examples
17
+
## Automated Testing
18
18
19
-
With one of the sidecars running, you can simply execute any of the examples in this directory using `python3`:
19
+
These examples can be tested automatically using [mechanical-markdown](https://github.com/dapr/mechanical-markdown), which validates that the examples run correctly and produce expected output.
20
+
21
+
To install mechanical-markdown:
22
+
23
+
```bash
24
+
python3 -m venv .venv
25
+
source .venv/bin/activate
26
+
pip install -e ../.
27
+
pip install mechanical-markdown
28
+
```
29
+
30
+
To see what commands would be run without executing them:
31
+
32
+
```bash
33
+
mm.py -d README.md
34
+
```
35
+
36
+
To run all examples and validate their output:
37
+
38
+
```bash
39
+
mm.py README.md
40
+
```
41
+
42
+
## Running the Examples
43
+
44
+
With one of the sidecars running, you can execute any of the examples in this directory using `python3`:
20
45
21
46
```sh
22
47
python3 ./activity_sequence.py
23
48
```
24
49
25
50
In some cases, the sample may require command-line parameters or user inputs. In these cases, the sample will print out instructions on how to proceed.
26
51
52
+
### Activity Sequence Example
53
+
54
+
This example demonstrates the functionchaining pattern, where an orchestrator schedules three activity calls in a sequence.
This example demonstrates parallel execution, where an orchestrator schedules a dynamic number of activity calls in parallel, waits for all of them to complete, and then performs an aggregation on the results.
72
+
73
+
<!-- STEP
74
+
name: Run fan-out/fan-in example
75
+
output_match_mode: substring
76
+
expected_stdout_lines:
77
+
- "Orchestration completed! Result"
78
+
-->
79
+
80
+
```bash
81
+
python fanout_fanin.py
82
+
```
83
+
84
+
<!-- END_STEP -->
85
+
86
+
### Human Interaction Example
87
+
88
+
This example demonstrates how an orchestrator can waitfor external events (like human approval) with a timeout. If the approval isn't received within the specified timeout, the order is automatically cancelled.
89
+
90
+
<!-- STEP
91
+
name: Run human interaction example with auto-approval
0 commit comments