Upgrade AmazonSQS Transport Version 5 to 6

Component: Amazon SQS Transport
This page targets a pre-release version and is subject to change prior to the final release.

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.UseTransport.

Instead of

var transport = endpointConfiguration.UseTransport<SqsTransport>();

Use:

var transport = new SqsTransport();
endpointConfiguration.UseTransport(transport);

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 optionVersion 7 configuration option
EnableV1CompatibilityModeEnableV1CompatibilityMode
MapEventMapEvent
MaxTimeToLiveMaxTimeToLive
PoliciesPolicies
TopicNameGeneratorTopicNameGenerator
TopicNamePrefixTopicNamePrefix
QueueNamePrefixQueueNamePrefix
Policies.AddAccountConditionPolicies.AccountCondition
Policies.AddTopicNamePrefixConditionPolicies.TopicNamePrefixCondition
Policies.AddNamespaceConditionPolicies.TopicNamespaceConditions
Policies.AssumePolicyHasAppropriatePermissionsPolicies.SetupTopicPoliciesWhenSubscribing

Last modified