NServiceBus.AzureFunctions.InProcess.ServiceBus component is no longer supported
Microsoft announced that .NET 8 will be the last release supporting the in-process hosting model and that beginning November 10, 2026, the in-process model for .NET apps in Azure Functions will no longer be supported. This component will also stop receiving any updates. New projects should use the isolated worker model instead. Follow these instructions to migrate.
To configure a custom trigger function, remove the native NServiceBusTriggerFunction attribute. A custom trigger function can then be added manually to the project:
class CustomTriggerDefinition(IFunctionEndpoint functionEndpoint)
{
[FunctionName("MyCustomTrigger")]
public Task Run(
[ServiceBusTrigger("MyFunctionsEndpoint")]
ServiceBusReceivedMessage message,
ServiceBusClient client,
ServiceBusMessageActions messageActions,
ILogger logger,
ExecutionContext executionContext)
{
return functionEndpoint.ProcessAtomic(message, executionContext, client, messageActions, logger);
}
}
Configuring transaction mode
To use the TransportTransactionMode. mode, AutoCompleteMessages needs to be disabled and the custom trigger needs to call ProcessAtomic.
[FunctionName("ProcessMessageTx")]
public Task RunTx(
// Setting AutoComplete to false processes the message transactionally
[ServiceBusTrigger("ProcessMessageTx", AutoCompleteMessages = false)]
ServiceBusReceivedMessage message,
ServiceBusClient client,
ServiceBusMessageActions messageActions,
ILogger logger,
ExecutionContext executionContext)
{
return endpoint.ProcessAtomic(message, executionContext, client, messageActions, logger);
}
To use the TransportTransactionMode. mode, AutoCompleteMessages needs to be enabled and the trigger needs to call ProcessNonAtomic.
[FunctionName("ProcessMessage")]
public async Task Run(
// Setting AutoComplete to true (the default) processes the message non-transactionally
[ServiceBusTrigger("ProcessMessage", AutoCompleteMessages = true)]
ServiceBusReceivedMessage message,
ILogger logger,
ExecutionContext executionContext)
{
await endpoint.ProcessNonAtomic(message, executionContext, logger);
}
Incorrectly configuring the service bus trigger AutoCompleteMessages setting can lead to message loss. Use the auto-detection mechanism on the function endpoint interface, or use the trigger function attribute to specify message consistency.