Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Migrating Azure Functions in-process to Isolated Worker
summary: Instructions on how to migrate Azure Functions in-process to Azure Functions Isolated Worker
component: ASBFunctionsWorker
reviewed: 2024-07-29
reviewed: 2024-08-23
related:
- nservicebus/hosting/azure-functions-service-bus/in-process
- samples/azure-functions/service-bus
Expand Down Expand Up @@ -146,3 +146,26 @@ class HttpSender
}
}
```

## Ensuring consistency in the Isolated Worker model

If `SendsAtomicWithReceive` was previously enabled in the in-process model (note that it is not enabled by default), maintaining that consistency guarantee in the isolated worker model may be important. However, achieving this consistency in the isolated worker model requires more than just adding an assembly attribute. To ensure consistency, consider the following options:

- **Implement the [Outbox pattern](/architecture/consistency.md#transactions-outbox-pattern)** to enable consistent database and message queue operations. (Recommended)
- Ensure that all receiver message handlers are [idempotent](/architecture/consistency.md#idempotency).

### Using SendsAtomicWithReceive in the In-Process model

In the in-process model, `SendsAtomicWithReceive` could be enabled by setting a boolean value to true in the assembly attribute:

```csharp
[assembly: NServiceBusTriggerFunction("ASBFunctionEndpoint", SendsAtomicWithReceive = true)]
```

### Changes in the Isolated Worker model

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.

```csharp
[assembly: NServiceBusTriggerFunction("ASBFunctionEndpoint")]
```