Skip to content

Commit a3650bb

Browse files
Merge pull request #313354 from hhunter-ms/hh-300237
[Durable][UUF] Move around examples to prioritize isolated
2 parents 592fe62 + 6385887 commit a3650bb

2 files changed

Lines changed: 41 additions & 25 deletions

File tree

articles/azure-functions/durable/durable-functions-fan-in-fan-out.md

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,6 @@ This orchestrator function does the following:
9090

9191
Here is the code that implements the orchestrator function:
9292

93-
[!code-csharp[Main](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs?range=16-42)]
94-
95-
> [!NOTE]
96-
> The sample linked in the prerequisites (`samples/precompiled`) uses the in-process model. The following **Isolated model** sections show equivalent code for the .NET isolated worker model.
97-
98-
Notice the `await Task.WhenAll(tasks);` line. The code doesn't await the individual calls to `E2_CopyFileToBlob`, so they run in parallel. When the orchestrator passes the task array to `Task.WhenAll`, it returns a task that doesn't complete until all copy operations complete. If you're familiar with the Task Parallel Library (TPL) in .NET, this pattern is familiar. The difference is that these tasks could be running on multiple virtual machines concurrently, and the Durable Functions extension ensures that the end-to-end execution is resilient to process recycling.
99-
100-
After the orchestrator awaits `Task.WhenAll`, all function calls are complete and return values. Each call to `E2_CopyFileToBlob` returns the number of bytes uploaded. Calculate the total by adding the return values.
101-
102-
<br>
103-
10493
<details>
10594
<summary><b>Isolated model</b></summary>
10695

@@ -137,6 +126,22 @@ public static class BackupSiteContent
137126
}
138127
```
139128

129+
Notice the `await Task.WhenAll(tasks);` line. The code doesn't await the individual calls to `E2_CopyFileToBlob`, so they run in parallel. When the orchestrator passes the task array to `Task.WhenAll`, it returns a task that doesn't complete until all copy operations complete. If you're familiar with the Task Parallel Library (TPL) in .NET, this pattern is familiar. The difference is that these tasks could be running on multiple virtual machines concurrently, and the Durable Functions extension ensures that the end-to-end execution is resilient to process recycling.
130+
131+
After the orchestrator awaits `Task.WhenAll`, all function calls are complete and return values. Each call to `E2_CopyFileToBlob` returns the number of bytes uploaded. Calculate the total by adding the return values.
132+
133+
</details>
134+
135+
<br>
136+
137+
<details>
138+
<summary><b>In-process model</b></summary>
139+
140+
[!code-csharp[Main](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs?range=16-42)]
141+
142+
> [!NOTE]
143+
> The [in-process model sample](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs) uses deprecated in-process packages. The preceding code shows the recommended .NET isolated worker model.
144+
140145
</details>
141146

142147
<br>
@@ -364,10 +369,6 @@ The helper activity functions are regular functions that use the `activityTrigge
364369

365370
# [C#](#tab/csharp)
366371

367-
[!code-csharp[Main](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs?range=44-54)]
368-
369-
<br>
370-
371372
<details>
372373
<summary><b>Isolated model</b></summary>
373374

@@ -400,6 +401,15 @@ public static class BackupSiteContent
400401

401402
<br>
402403

404+
<details>
405+
<summary><b>In-process model</b></summary>
406+
407+
[!code-csharp[Main](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs?range=44-54)]
408+
409+
</details>
410+
411+
<br>
412+
403413
# [JavaScript](#tab/javascript)
404414

405415
<details>
@@ -457,18 +467,12 @@ Java sample coming soon.
457467

458468
# [C#](#tab/csharp)
459469

460-
[!code-csharp[Main](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs?range=56-81)]
461-
462-
> [!NOTE]
463-
> To run the sample code, install the `Microsoft.Azure.WebJobs.Extensions.Storage` NuGet package.
464-
465-
The function uses Azure Functions binding features like the [`Binder` parameter](../functions-dotnet-class-library.md#binding-at-runtime). You don't need those details for this walkthrough.
466-
467-
<br>
468-
469470
<details>
470471
<summary><b>Isolated model</b></summary>
471472

473+
> [!NOTE]
474+
> To run the sample code, install the `Azure.Storage.Blobs` NuGet package.
475+
472476
```csharp
473477
using System;
474478
using System.IO;
@@ -518,6 +522,18 @@ public static class BackupSiteContent
518522

519523
<br>
520524

525+
<details>
526+
<summary><b>In-process model</b></summary>
527+
528+
[!code-csharp[Main](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs?range=56-81)]
529+
530+
> [!NOTE]
531+
> The in-process model sample requires the `Microsoft.Azure.WebJobs.Extensions.Storage` NuGet package and uses Azure Functions binding features like the [`Binder` parameter](../functions-dotnet-class-library.md#binding-at-runtime).
532+
533+
</details>
534+
535+
<br>
536+
521537
# [JavaScript](#tab/javascript)
522538

523539
<details>

includes/durable-functions-prerequisites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.author: glenga
1111
# [C#](#tab/csharp)
1212

1313
* [Complete the quickstart article](../articles/azure-functions/durable/durable-functions-isolated-create-first-csharp.md)
14-
* [Clone or download the samples project from GitHub](https://github.com/Azure/azure-functions-durable-extension/tree/master/samples/precompiled)
14+
* [Clone or download the samples project from GitHub](https://github.com/Azure/azure-functions-durable-extension/tree/master/samples/precompiled) (uses the in-process model)
1515

1616
# [JavaScript](#tab/javascript)
1717

0 commit comments

Comments
 (0)