Upgrade from NServiceBus Azure Version 6

Component: Azure Storage Persistence
This page targets a pre-release version and is subject to change prior to the final release.
Upgrades from NServiceBus.Azure Versions 6.2.3 and below will need to apply the saga de-duplication patch followed by applying the saga index patch before completing the remainder of these upgrade steps.

Changing Nuget Packages and namespaces

One of the most visible changes for this persister was moving it from the NServiceBus.Azure package to the NServiceBus.Persistence.AzureStorage package. This change in packaging has reset the version number to Version 1.

Upgrading to the new package requires removing the NServiceBus.Azure NuGet package from the project and adding the NServiceBus.Persistence.AzureStorage NuGet package.

Once the packages have been changed, any use of the NServiceBus.Azure namespace needs to be replaced with NServiceBus.Persistence.AzureStorage.

New Configuration API

In Versions 6 and below the Azure Storage Persistence was configured using XML configuration sections called AzureSubscriptionStorageConfig, AzureSagaPersisterConfig, and AzureTimeoutPersisterConfig. These XML configuration sections have been obsoleted in favor of a more granular, code based configuration API.

For example, the following Xml:

6.x NServiceBus.Azure
<configSections>
  <section name="AzureSubscriptionStorageConfig"
           type="NServiceBus.Config.AzureSubscriptionStorageConfig, NServiceBus.Azure" />
  <section name="AzureSagaPersisterConfig"
           type="NServiceBus.Config.AzureSagaPersisterConfig, NServiceBus.Azure" />
  <section name="AzureTimeoutPersisterConfig"
           type="NServiceBus.Config.AzureTimeoutPersisterConfig, NServiceBus.Azure" />
</configSections>
<AzureSagaPersisterConfig ConnectionString="UseDevelopmentStorage=true" />
<AzureTimeoutPersisterConfig ConnectionString="UseDevelopmentStorage=true" />
<AzureSubscriptionStorageConfig ConnectionString="UseDevelopmentStorage=true" />
5.x NServiceBus.Azure
<configSections>
  <section name="AzureSubscriptionStorageConfig"
           type="NServiceBus.Config.AzureSubscriptionStorageConfig, NServiceBus.Azure" />
  <section name="AzureSagaPersisterConfig"
           type="NServiceBus.Config.AzureSagaPersisterConfig, NServiceBus.Azure" />
  <section name="AzureTimeoutPersisterConfig"
           type="NServiceBus.Config.AzureTimeoutPersisterConfig, NServiceBus.Azure" />
</configSections>
<AzureSagaPersisterConfig ConnectionString="UseDevelopmentStorage=true" />
<AzureTimeoutPersisterConfig ConnectionString="UseDevelopmentStorage=true" />
<AzureSubscriptionStorageConfig ConnectionString="UseDevelopmentStorage=true" />

changes to this code configuration:

2-pre NServiceBus.Persistence.AzureStorage
var persistence = endpointConfiguration.UsePersistence<AzureStoragePersistence>();
persistence.ConnectionString("connectionString");
1.x NServiceBus.Persistence.AzureStorage
var persistence = endpointConfiguration.UsePersistence<AzureStoragePersistence>();
persistence.ConnectionString("connectionString");

The new configuration APIs are accessible through extension methods on the UsePersistence<AzureStoragePersistence, StorageType.Sagas>(), UsePersistence<AzureStoragePersistence, StorageType.Subscriptions>(), and UsePersistence<AzureStoragePersistence, StorageType.Timeouts>() extension points in the endpoint configuration. See Azure Storage Persistence Code Configuration for more details on code configuration API use.

Related Articles


Last modified