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
Write-Host "Both tasks completed with results: $results"
36
42
```
37
43
38
-
This example demonstrates waiting for multiple durable activity tasks to complete and retrieving their results. The activities are invoked with -NoWait to return task objects immediately.
44
+
This example demonstrates waiting for multiple durable activity tasks to complete. Note that Wait-DurableTask returns the task objects themselves, not the results. To get the actual activity results, you need to use Get-DurableTaskResult on each completed task.
Write-Host "SlowOperation completed first with result: $activityResult"
60
+
} else {
61
+
# This block should never be hit
62
+
Write-Host "Unexpected task completion"
63
+
}
47
64
```
48
65
49
-
This example demonstrates waiting for any one of the tasks to complete using the -Any parameter. The cmdlet returns as soon as the first task finishes, which is useful for implementing timeout patterns or race conditions.
66
+
This example demonstrates waiting for any one of the tasks to complete using the -Any parameter. The cmdlet returns the first completed task object (not the result), which you can then compare to determine which task finished first and retrieve its actual result using Get-DurableTaskResult.
50
67
51
68
## PARAMETERS
52
69
@@ -112,15 +129,16 @@ This cmdlet does not accept pipeline input. All parameters must be specified dir
112
129
113
130
### System.Object
114
131
115
-
Returns the result(s) of the completed task(s). If waiting for a single task, returns the task result directly. If waiting for multiple tasks, returns an array of results in the same order as the input tasks.
132
+
Returns the completed task object(s), not the task results. If waiting for a single task, returns the task object directly. If waiting for multiple tasks, returns an array of task objects in the same order as the input tasks. To get the actual results from the tasks, use Get-DurableTaskResult on the returned task objects.
116
133
117
134
## NOTES
118
135
119
136
- This cmdlet can only be used within orchestrator functions, not in activity functions or client functions.
120
-
- When using the -Any parameter, only the result of the first completed task is returned. Other tasks continue running in the background.
137
+
- When using the -Any parameter, only the first completed task object is returned. Other tasks continue running in the background.
121
138
- Tasks passed to this cmdlet must be created with the -NoWait parameter from other durable cmdlets.
122
139
- The cmdlet is fault-tolerant and will survive orchestration replays and restarts.
123
-
- When waiting for multiple tasks without -Any, results are returned in the same order as the input tasks, regardless of completion order.
140
+
- When waiting for multiple tasks without -Any, task objects are returned in the same order as the input tasks, regardless of completion order.
141
+
- This cmdlet returns task objects, not task results. Use Get-DurableTaskResult to retrieve the actual results from completed tasks.
124
142
- Use this cmdlet to implement common patterns like fan-out/fan-in, timeouts, and race conditions in orchestrations.
0 commit comments