Skip to content

Commit 265a293

Browse files
committed
move around isolated and in proc models
Signed-off-by: Hannah Hunter <[email protected]>
1 parent d91d44c commit 265a293

1 file changed

Lines changed: 42 additions & 26 deletions

File tree

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

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,7 @@ 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-
104-
<details>
93+
<details open>
10594
<summary><b>Isolated model</b></summary>
10695

10796
```csharp
@@ -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,11 +369,7 @@ 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-
371-
<details>
372+
<details open>
372373
<summary><b>Isolated model</b></summary>
373374

374375
```csharp
@@ -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,17 +467,11 @@ Java sample coming soon.
457467

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

460-
[!code-csharp[Main](~/samples-durable-functions/samples/precompiled/BackupSiteContent.cs?range=56-81)]
470+
<details open>
471+
<summary><b>Isolated model</b></summary>
461472

462473
> [!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-
469-
<details>
470-
<summary><b>Isolated model</b></summary>
474+
> To run the sample code, install the `Azure.Storage.Blobs` NuGet package.
471475
472476
```csharp
473477
using System;
@@ -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>

0 commit comments

Comments
 (0)