Azure Storage Queues Transport Upgrade Version 6 to 7

Component: Azure Storage Queues Transport
This page targets a pre-release version and is subject to change prior to the final release.

New Configuration API

In versions 6 and below, the Azure Storage Queues transport was configured using an XML configuration section called AzureStorageQueueTransportConfiguration. This section has been removed in favor of a more granular, code-based configuration API.

The new configuration API is accessible through extension methods on the UseTransport<AzureStorageQueueTransport>() extension point in the endpoint configuration. See also Azure Storage Queues Configuration.

7.x NServiceBus.Azure.Transports.WindowsAzureStorageQueues
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
// Configure the transport
transport.ConnectionString("The Connection String");

To continue reading from app.config

Add the following to the app.config:

7.x NServiceBus.Azure.Transports.WindowsAzureStorageQueues
<configuration>
  <appSettings>
    <add key="AzureStorageQueueConnection"
         value="The Connection String" />
  </appSettings>
</configuration>

Then read from app.config and pass the value to the transport configuration:

7.x NServiceBus.Azure.Transports.WindowsAzureStorageQueues
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
var connection = ConfigurationManager.AppSettings["AzureStorageQueueConnection"];
transport.ConnectionString(connection);

Setting the configuration values via API

Setting the configuration values can now be done via API in the following way:

These values can be set using corresponding extension methods:

8-pre NServiceBus.Azure.Transports.WindowsAzureStorageQueues
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
transport.ConnectionString("DefaultEndpointsProtocol=https;AccountName=[ACCOUNT];AccountKey=[KEY];");
transport.BatchSize(20);
transport.MaximumWaitTimeWhenIdle(TimeSpan.FromSeconds(1));
transport.DegreeOfReceiveParallelism(16);
transport.PeekInterval(TimeSpan.FromMilliseconds(100));
transport.MessageInvisibleTime(TimeSpan.FromSeconds(30));
7.x NServiceBus.Azure.Transports.WindowsAzureStorageQueues
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
transport.ConnectionString("DefaultEndpointsProtocol=https;AccountName=[ACCOUNT];AccountKey=[KEY];");
transport.BatchSize(20);
transport.MaximumWaitTimeWhenIdle(TimeSpan.FromSeconds(1));
transport.DegreeOfReceiveParallelism(16);
transport.PeekInterval(TimeSpan.FromMilliseconds(100));
transport.MessageInvisibleTime(TimeSpan.FromSeconds(30));

PurgeOnStartup

The PurgeOnStartup setting now can be set on EndpointConfiguration using an extension method.

7.x NServiceBus.Azure.Transports.WindowsAzureStorageQueues
endpointConfiguration.PurgeOnStartup(true);

DefaultQueuePerInstance

The DefaultQueuePerInstance setting is deprecated. For setting this behavior, refer to the Data distribution article.

Default value changes

The default values of the following settings have been changed:

  • ConnectionString, which had a default value of UseDevelopmentStorage=true, was removed and became mandatory.
  • BatchSize changed from 10 to 32.

Serialization

In previous versions of the Azure Storage Queues transport, change the default SerializationDefinition to JsonSerializer.

In version 6 of NServiceBus, transports no longer have the ability to manipulate serialization. To preserve backward compatibility and ensure that message payloads are small, setting JSON serialization should now be done on the endpoint configuration level.

7.x NServiceBus.Azure.Transports.WindowsAzureStorageQueues
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.UseTransport<AzureStorageQueueTransport>();

API Changes

In version 7, the public API has been reduced. As a result, multiple classes that used to be public in version 6 and below were marked as obsolete with a comment:

This class served only internal purposes without providing any extensibility point and as such was removed from the public API. For more information, refer to the documentation.

If code exists that depends on classes that were deprecated with the above message, and it is not clear how to update it, contact support to get help in resolving that issue.

Related Articles


Last modified