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
You'll see output indicating that the worker has started and is waiting for work items.
222
253
223
254
```
224
-
INFO:__main__:Starting Fan Out/Fan In pattern worker...
255
+
Starting Fan Out/Fan In pattern worker...
225
256
Using taskhub: default
226
257
Using endpoint: http://localhost:8080
227
-
2025-04-23 12:56:58.612 durabletask-worker INFO: Starting gRPC worker that connects to http://localhost:8080
228
-
2025-04-23 12:56:58.830 durabletask-worker INFO: Successfully connected to http://localhost:8080. Waiting for work items...
258
+
Starting gRPC worker that connects to http://localhost:8080
259
+
Successfully connected to http://localhost:8080. Waiting for work items...
229
260
```
230
261
231
262
1. In a new terminal (with the virtual environment activated, if applicable), run the client.
@@ -242,13 +273,19 @@ Total items processed: 5
242
273
243
274
### Understanding the output
244
275
245
-
When you run this sample, you receive output from both the worker and client processes. The worker output shows:
276
+
When you run this sample, you receive output from both the worker and client processes.
277
+
278
+
#### Worker output
279
+
280
+
The worker output shows:
246
281
247
282
- Registration of the orchestrator and activities.
248
283
- Status messages when processing each work item in parallel, showing that they're executing concurrently.
249
284
- Random delays for each work item (between 0.5 and 2 seconds) to simulate varying processing times.
250
285
- A final message showing the aggregation of results.
251
286
287
+
#### Client output
288
+
252
289
The client output shows:
253
290
254
291
- Starting the orchestration with the specified number of work items.
@@ -258,7 +295,7 @@ The client output shows:
258
295
- Sum of all results (each item result is the square of its value)
259
296
- Average of all results
260
297
261
-
**Example output**
298
+
#### Example output
262
299
263
300
```
264
301
Starting fan out/fan in orchestration with 10 items
@@ -293,6 +330,60 @@ Orchestration completed with status: COMPLETED
293
330
294
331
::: zone pivot="java"
295
332
333
+
1. Install the required packages.
334
+
335
+
```bash
336
+
337
+
```
338
+
339
+
1. Start the worker.
340
+
341
+
```bash
342
+
343
+
```
344
+
345
+
1. In a new terminal, run the client.
346
+
347
+
```bash
348
+
349
+
```
350
+
351
+
You can provide the number of work items as an argument. If no argument is provided, the example runs 10 items by default.
352
+
353
+
```bash
354
+
355
+
```
356
+
357
+
### Understanding the output
358
+
359
+
When you run this sample, you receive output from both the worker and client processes.
360
+
361
+
#### Worker output
362
+
363
+
The worker output shows:
364
+
365
+
- Registration of the orchestrator and activities.
366
+
- Status messages when processing each work item in parallel, showing that they're executing concurrently.
367
+
- Random delays for each work item (between 0.5 and 2 seconds) to simulate varying processing times.
368
+
- A final message showing the aggregation of results.
369
+
370
+
#### Client output
371
+
372
+
The client output shows:
373
+
374
+
- Starting the orchestration with the specified number of work items.
375
+
- The unique orchestration instance ID.
376
+
- The final aggregated result, which includes:
377
+
- Total number of items processed
378
+
- Sum of all results (each item result is the square of its value)
379
+
- Average of all results
380
+
381
+
#### Example output
382
+
383
+
```
384
+
385
+
```
386
+
296
387
::: zone-end
297
388
298
389
@@ -310,13 +401,17 @@ You can view the orchestration status and history via the [Durable Task Schedule
310
401
- The input and output at each step
311
402
- The time taken for each step
312
403
404
+
::: zone-end
405
+
406
+
::: zone pivot="csharp"
407
+
313
408
:::image type="content" source="media/quickstart-portable-durable-task-sdks/review-dashboard.png" alt-text="Screenshot showing the orchestartion instance's details.":::
314
409
315
410
::: zone-end
316
411
317
412
::: zone pivot="csharp,python,java"
318
413
319
-
## What happened?
414
+
## Understanding the code structure
320
415
321
416
::: zone-end
322
417
@@ -507,6 +602,55 @@ result = client.wait_for_orchestration_completion(
507
602
508
603
:::zonepivot="java"
509
604
605
+
### Worker
606
+
607
+
Todemonstrate [thefan-out/fan-inpattern](../durable/durable-functions-overview.md#fan-in-out), theworkerprojectorchestrationcreatesparallelactivitytasksandwaitsfor all to complete. The orchestrator:
608
+
609
+
1. Takes a list of work items as input.
610
+
1. Fans out by creating a separate task for each work item using ``.
611
+
1. Executes all tasks in parallel.
612
+
1. Waits for all tasks to complete using ``.
613
+
1. Fans in by aggregating all individual results using ``.
614
+
1. Returns the final aggregated result to the client.
615
+
616
+
Using fan-out/fan-in, the orchestration creates parallel activity tasks and waits for all to complete.
617
+
618
+
```java
619
+
620
+
```
621
+
622
+
#### Client
623
+
624
+
The worker uses `Microsoft.Extensions.Hosting` for proper lifecycle management.
0 commit comments