This is part of the NServiceBus Upgrade Guide from Version 6 to 7, which also includes the following individual upgrade guides for specific components:
Transports
- Migrating MSMQ subscription messages
- Azure Service Bus Transport (Legacy) Upgrade Version 7 to 8
- Azure Storage Queues Transport Upgrade Version 7 to 8
- RabbitMQ Transport Upgrade Version 4 to 5
- SQL Server Transport Upgrade Version 3 to 4
Persistence
Hosting
Other
Sanitization
In previous versions, the transport was responsible for sanitization of the queue names. That included:
- Replacing invalid characters
- Converting name to lowercase
- Shortening queue names exceeding the maximum allowed queue name length, using SHA1 or MD5
In Versions 8 and above, the transport is no longer performing sanitization by default. Instead, sanitization logic must be registered.
// For Azure Storage Queues Transport version 11.x
var transport = new AzureStorageQueueTransport("connection string")
{
QueueNameSanitizer = queueName => queueName.Replace('.', '-')
};
endpointConfiguration.UseTransport(transport);
// For Azure Storage Queues Transport version 10.x
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
transport.SanitizeQueueNamesWith(queueName => queueName.Replace('.', '-'));
// For Azure Storage Queues Transport version 9.x
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
transport.SanitizeQueueNamesWith(queueName => queueName.Replace('.', '-'));
// For Azure Storage Queues Transport version 8.x
var transport = endpointConfiguration.UseTransport<AzureStorageQueueTransport>();
transport.SanitizeQueueNamesWith(queueName => queueName.Replace('.', '-'));
Serialization is mandatory
In Versions 7 and below, the transport was setting the default serialization. In Versions 8 and above, the transport no longer sets the default serialization. Instead, it must be configured.
For backwards compatibility with the previous default serialization, NServiceBus.
serializer must be used.
// For Azure Storage Queues Transport version 11.x
endpointConfiguration.UseSerialization<NewtonsoftJsonSerializer>();
// For Azure Storage Queues Transport version 10.x
endpointConfiguration.UseSerialization<NewtonsoftJsonSerializer>();
// For Azure Storage Queues Transport version 9.x
endpointConfiguration.UseSerialization<NewtonsoftJsonSerializer>();
// For Azure Storage Queues Transport version 8.x
endpointConfiguration.UseSerialization<NewtonsoftJsonSerializer>();