Support for Azure.Messaging.ServiceBus Version 7 client library for .NET

Hi everyone,

We’ve just released:

  • NServiceBus.Transport.AzureServiceBus Version 2
  • NServiceBus.AzureFunctions.Worker.ServiceBus Version 2
  • NServiceBus.AzureFunctions.InProcess.ServiceBus Version 2 (Only uses the new SDK for the NServiceBus parts)

which all use the new Azure Service Bus client library Version 7 for .NET.

Most notably the new client library brings support for authentication using Azure Identity.

You can read more about the features and improvements in the Microsoft client library migration guide.

Please refer to our upgrade guides for more details on how to upgrade:

Where to get it

You can install the new versions:

from NuGet.

With thanks,
The team in Particular

Please read our release policy for more details.

1 Like

@andreasohlund, the upgrade guide for Functions In-Process is showing the following configuration code:

functionsHostBuilder.UseNServiceBus(endpointName, nsb =>
{
    var connectionString = Environment.GetEnvironmentVariable(connectionStringName);
    nsb.ServiceBusConnectionString = connectionString;
});

but it doesn’t look like v2 has that overload or API:


image

And I’ve confirmed the package is NServiceBus.AzureFunctions.InProcess.ServiceBus 2.0.2.

Hi Sean!

Good catch, that API is added in the upcoming Version 3 so it was added by mistake to the 1=>2 upgrade guide. I have removed it from https://docs.particular.net/nservicebus/upgrades/azure-functions-service-bus-1to2

Cheers,

Andreas

There’s an issue, @andreasohlund. To use Azure Functions In-Process SDK with ASB SDK, the Microsoft.Azure.WebJobs.Extensions.ServiceBus package needs to be referenced. And to use the Azure.Messaging.ServiceBus SDK, the version of the Microsoft.Azure.WebJobs.Extensions.ServiceBus package has to be 5.0.0-beta.6 and not 4.3.0 as it is right now.

image

And the auto-generated trigger function confirms that as it’s still using ASB SDK track 2 Message type :slightly_frowning_face:

At this point, the package is not leveraging the latest ASB SDK aside from dispatching messages via NServiceBus. The trigger function is still on the previous ASB SDK version. This has a side effect on things such as Application Insights. For example, Semantic Open Telemetry will not capture the incoming trigger messages as it only works with the latest ASB SDK.

A possible fix would be to override Microsoft.Azure.WebJobs.Extensions.ServiceBus and use 5.0.0-beta.6. This will also require disabling auto-generation of the trigger function but that just feels clunky for a release that claims to support the latest ASB SDK.

Raised an issue for In-Process package.

You are correct, we didn’t want to reference a beta so it currently only uses the new SDK for the “NServiceBus parts”. I think it’s best to wait for Microsoft to ship the final version and then release a new version of our functions package that uses the new 5.0 of Microsoft.Azure.WebJobs.Extensions.ServiceBus. What do you think?

You could have shipped 2.0.2 unstable and then released a final when the stable version of Microsoft.Azure.WebJobs.Extensions.ServiceBus is out. That way, it would not introduce the confusion and mixing of the two ASB SDKs. Yes, you’ll need to release a new version of the package the way it is done now. The document should highlight that for version 2.0.2, and the ASB SDK 7 is only available for dispatching via NServiceBus while the trigger and receiving are still on the older ASB SDK.

The stable version of Microsoft.Azure.WebJobs.Extensions.ServiceBus is out @andreasohlund. Time to release an updated version. Sorry, the PR I had is stale now but the work there can be salvaged. Looking forward to the next release to address the discrepancy between the trigger and the dispatcher. Thank you.

Thanks @SeanFeldman , I’ll rebase the PR to verify that it works as expected.

Just a quick status update:

The work on updating to Microsoft.Azure.WebJobs.Extensions.ServiceBus 5.0.0 uncovered an issue where the SDK doesn’t expose a way to enable the transfers/send-via feature of Azure ServiceBus. This prevents us from supporting the AtomicSendsWithReceive transaction mode.

We’ve made Microsoft aware of this and they have already made the necessary changes so once there is a new release of the SDK we’ll update our functions package and release a new version.

1 Like