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
Delayed delivery
The unrestricted delayed delivery is now always enabled so the UnrestrictedDurationDelayedDelivery()
API has been deprecated.
Configuring the SQS transport
To use the SQS transport for NServiceBus, create a new SqsTransport
instance and pass it to EndpointConfiguration.
.
Instead of:
var transport = endpointConfiguration.UseTransport<SqsTransport>();
Use:
var transport = new SqsTransport();
endpointConfiguration.UseTransport(transport);
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.
SDK clients
Customizing instances of the SQS and SNS SDK clients is now done via the SqsTransport
constructor.
Instead of:
var transport = endpointConfiguration.UseTransport<SqsTransport>();
transport.ClientFactory(() => new AmazonSQSClient());
transport.ClientFactory(() => new AmazonSimpleNotificationServiceClient());
Use:
var transport = new SqsTransport(
new AmazonSQSClient(),
new AmazonSimpleNotificationServiceClient());
endpointConfiguration.UseTransport(transport);
S3 configuration
Enabling S3 for handling large messages is now configured via the S3
property of the transport definition.
By default, the value is null
which means S3 usage for sending large messages is disabled.
Instead of:
var transport = endpointConfiguration.UseTransport<SqsTransport>();
var s3Configuration = transport.S3("nsb-sqs-messages", "my/sample/path");
s3Configuration.ClientFactory(() => new AmazonS3Client());
Use:
var transport = new SqsTransport
{
S3 = new S3Settings(
bucketForLargeMessages: "nsb-sqs-messages",
keyPrefix: "my/sample/path",
s3Client: new AmazonS3Client())
};
endpointConfiguration.UseTransport(transport);
Encryption
Message payload encryption is now configured via the Encryption
property of the S3 settings object.
By default, the value is null
which means the messages are not encrypted.
Instead of:
var transport = endpointConfiguration.UseTransport<SqsTransport>();
var s3Configuration = transport.S3(bucketName, keyPrefix);
s3Configuration.ServerSideEncryption(ServerSideEncryptionMethod.AES256, keyManagementServiceKeyId: "MyKeyId");
Use:
var transport = new SqsTransport
{
S3 = new S3Settings(bucketName, keyPrefix)
{
Encryption = new S3EncryptionWithManagedKey(ServerSideEncryptionMethod.AES256, "keyId")
}
};
endpointConfiguration.UseTransport(transport);