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
- Upgrade AmazonSQS Transport 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
- RabbitMQ Transport Upgrade Version 7 to 8
- SQL Server Transport Upgrade Version 6 to 7
Persistence
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);
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.SDK clients
In order to pass customized instances of the SQS and SNS SDK clients to the transport use the corresponding SqsTransport
constructor overload.
var transport = new SqsTransport(
new AmazonSQSClient(),
new AmazonSimpleNotificationServiceClient());
endpointConfiguration.UseTransport(transport);
S3 configuration
The S3 usage for large messages is configured via the S3
property of the transport. By default, the value is null
which means S3 usage for sending large messages is disabled.
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 configured via the Encryption
property of the S3 settings object. By default, the value is null
which means the messages are not encrypted.
var transport = new SqsTransport
{
S3 = new S3Settings(bucketName, keyPrefix)
{
Encryption = new S3EncryptionWithManagedKey(ServerSideEncryptionMethod.AES256, "keyId")
}
};
endpointConfiguration.UseTransport(transport);
Configuration options
The SQS transport configuration options that have not changed have been moved to the SqsTransport
class. See the following table for further information:
Version 6 configuration option | Version 7 configuration option |
---|---|
EnableV1CompatibilityMode | EnableV1CompatibilityMode |
MapEvent | MapEvent |
MaxTimeToLive | MaxTimeToLive |
Policies | Policies |
TopicNameGenerator | TopicNameGenerator |
TopicNamePrefix | TopicNamePrefix |
QueueNamePrefix | QueueNamePrefix |
Policies.AddAccountCondition | Policies.AccountCondition |
Policies.AddTopicNamePrefixCondition | Policies.TopicNamePrefixCondition |
Policies.AddNamespaceCondition | Policies.TopicNamespaceConditions |
Policies.AssumePolicyHasAppropriatePermissions | Policies.SetupTopicPoliciesWhenSubscribing |