Getting Started
Architecture
NServiceBus
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Samples

Azure Storage Queues Transport Upgrade Version 10 to 11

Configuring the transport

To use the Azure Storage Queues transport for NServiceBus, create a new instance of AzureStorageQueueTransport and pass it to EndpointConfiguration.UseTransport.

Instead of:

var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
transport.Transactions(TransportTransactionMode.ReceiveOnly);

var routing = t.Routing();
routing.RouteToEndpoint(typeof(MyMessage), "DestinationEndpoint");

Use:

var transport = new AzureStorageQueueTransport("azure-storage-connection-string")
{
    TransportTransactionMode = TransportTransactionMode.ReceiveOnly
};

var routing = endpointConfiguration.UseTransport(transport);
routing.RouteToEndpoint(typeof(MyMessage), "DestinationEndpoint");
The existing API surface with UseTransport<T>() is supported for NServiceBus version 8 via a shim API to ease migration to the new version. However, it is recommended to switch to the new transport configuration API to prepare for future upgrades of NServiceBus.

Configure clients

Configuring clients for queue, blob or table is done via the constructor overload. Setting those via properties is no longer possible.

Configuration options

The Azure Storage Queues transport configuration options have been moved to the AzureStorageQueueTransport class properties and constructors. See the following table for further information:

Version 9 configuration optionVersion 10 configuration option
MessageInvisibleTimeMessageInvisibleTime
PeekIntervalPeekInterval
MaximumWaitTimeWhenIdleMaximumWaitTimeWhenIdle
SanitizeQueueNamesWithQueueNameSanitizer
BatchSizeReceiverBatchSize
DegreeOfReceiveParallelismDegreeOfReceiveParallelism
SerializeMessageWrapperWithMessageWrapperSerializationDefinition
UnwrapMessagesWithMessageUnwrapper
AccountRoutingAccountRouting
DefaultAccountAliasAccountRouting.DefaultAccountAlias
DelayedDeliveryDelayedDelivery
DelayedDelivery.UseTableNameDelayedDelivery.DelayedDeliveryTableName
DisableDelayedDeliveryuse the transport constructor overload
UseQueueServiceClientuse the transport constructor overload
UseBlobServiceClientuse the transport constructor overload
UseCloudTableClientuse the transport constructor overload

Account routing changes

When setting up aliases for account routing, use the overload that accepts QueueServiceClient and CloudTableClient instances instead of the deprecated overload that accepts a connection string (which will be removed in a future version).

Instead of:

var accountRouting = transport.AccountRouting();
accountRouting.AddAccount("accountAlias", "account_connection_string");

Use:

var accountRouting = transport.AccountRouting();
accountRouting.AddAccount(
    "accountAlias",
    new QueueServiceClient("account_connection_string"),
    CloudStorageAccount.Parse("account_connection_string").CreateCloudTableClient());

Related Articles