This is part of the NServiceBus Upgrade Guide from Version 7 to 8, which also includes the following individual upgrade guides for specific components:
Feature Details
- Upgrading the data bus from version 7 to 8
- Dependency Injection changes
- Upgrade NServiceBus downstreams from Version 7 to 8
- Upgrading message contracts from Version 7 to 8
- Upgrade NServiceBus pipeline extensions from Version 7 to 8
- Transport configuration changes
Transports
- AmazonSQS Transport Upgrade Version 5 to 6
- Azure Service Bus Transport Upgrade Version 2 to 3
- Azure Storage Queues Transport Upgrade Version 10 to 11
- MSMQ Transport Upgrade Version 1 to 2
- MSMQ Transport Upgrade Version 2 to 2.0.4
- RabbitMQ Transport Upgrade Version 7 to 8
- SQL Server Transport Upgrade Version 6 to 7
Persistence
- Cosmos DB Persistence Upgrade from 1 to 2
- NHibernate Persistence Upgrade Version 8 to 9
- RavenDB Persistence Upgrade from 7 to 8
- SQL Persistence Upgrade Version 6 to 7
Hosting
Other
Configuring the transport
To use the Azure Storage Queues transport for NServiceBus, create a new instance of AzureStorageQueueTransport
and pass it to EndpointConfiguration.
.
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
is supported via a shim API to ease migration. 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 option | Version 10 configuration option |
---|---|
MessageInvisibleTime | MessageInvisibleTime |
PeekInterval | PeekInterval |
MaximumWaitTimeWhenIdle | MaximumWaitTimeWhenIdle |
SanitizeQueueNamesWith | QueueNameSanitizer |
BatchSize | ReceiverBatchSize |
DegreeOfReceiveParallelism | DegreeOfReceiveParallelism |
SerializeMessageWrapperWith | MessageWrapperSerializationDefinition |
UnwrapMessagesWith | MessageUnwrapper |
AccountRouting | AccountRouting |
DefaultAccountAlias | AccountRouting.DefaultAccountAlias |
DelayedDelivery | DelayedDelivery |
DelayedDelivery.UseTableName | DelayedDelivery.DelayedDeliveryTableName |
DisableDelayedDelivery | use the transport constructor overload |
UseQueueServiceClient | use the transport constructor overload |
UseBlobServiceClient | use the transport constructor overload |
UseCloudTableClient | use 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());