Skip to content

Commit 71cbf2b

Browse files
author
Travis Nickels
authored
Add consistency section for isolated worker migration guide (#6815)
1 parent 6433e1d commit 71cbf2b

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

nservicebus/upgrades/azure-functions-service-bus-in-process-isolated-worker.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Migrating Azure Functions in-process to Isolated Worker
33
summary: Instructions on how to migrate Azure Functions in-process to Azure Functions Isolated Worker
44
component: ASBFunctionsWorker
5-
reviewed: 2024-07-29
5+
reviewed: 2024-08-23
66
related:
77
- nservicebus/hosting/azure-functions-service-bus/in-process
88
- samples/azure-functions/service-bus
@@ -129,8 +129,7 @@ class HttpSender
129129

130130
[Function("HttpSender")]
131131
public async Task<HttpResponseData> Run(
132-
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestData req,
133-
FunctionContext functionContext)
132+
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestData req, FunctionContext functionContext)
134133
{
135134
var logger = functionContext.GetLogger<HttpSender>();
136135
logger.LogInformation("C# HTTP trigger function received a request.");
@@ -146,3 +145,25 @@ class HttpSender
146145
}
147146
}
148147
```
148+
149+
## Ensuring consistency in the Isolated Worker model
150+
151+
If `SendsAtomicWithReceive` was previously [enabled in the in-process model](/nservicebus/hosting/azure-functions-service-bus/in-process/#message-consistency) (note that it is not enabled by default), maintaining that consistency guarantee in the isolated worker model is important.
152+
153+
Lower [transaction modes](/transports/transactions.md#transactions) can result in the duplication of outgoing messages otherwise known as [ghost messages](/nservicebus/concepts/glossary.md#ghost-message). To ensure that [consistency](/architecture/consistency.md) is maintained make sure that all involved message handlers are [idempotent](/architecture/consistency.md#idempotency).
154+
155+
### Using SendsAtomicWithReceive in the In-Process model
156+
157+
In the in-process model, `SendsAtomicWithReceive` could be enabled by setting a boolean value to true in the assembly attribute:
158+
159+
```csharp
160+
[assembly: NServiceBusTriggerFunction("ASBFunctionEndpoint", SendsAtomicWithReceive = true)]
161+
```
162+
163+
### Changes in the Isolated Worker model
164+
165+
In the isolated worker model, the `SendsAtomicWithReceive` attribute is not supported. This is because the `Microsoft.Azure.Functions.Worker.Sdk` cannot natively manage transactions across the separate processes that run the function code and the host runtime. Unlike the in-process model, where the function code and the host runtime share the same process, making transaction management more feasible, the isolated worker model requires this setting to be removed from the assembly attribute.
166+
167+
```csharp
168+
[assembly: NServiceBusTriggerFunction("ASBFunctionEndpoint")]
169+
```

0 commit comments

Comments
 (0)