Getting Started
NServiceBus
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Previews
Samples

Azure Service Bus Transport Upgrade Version 2 to 3

Configuring the Azure Service Bus transport

To use the Azure Service Bus transport for NServiceBus, create a new instance of AzureServiceBusTransport and pass it to EndpointConfiguration.UseTransport.

Instead of:

var transport = endpointConfiguration.UseTransport<AzureServiceBusTransport>();
transport.ConnectionString(connectionString);

Use:

var transport = new AzureServiceBusTransport(connectionString);
endpointConfiguration.UseTransport(transport);
The existing API surface with 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.

Configuration options

The Azure Service Bus transport configuration options have been moved to the AzureServiceBusTransport class. See the following table for further information:

Version 1 configuration optionVersion 2 configuration option
TopicNameTopicName
EntityMaximumSizeEntityMaximumSize
EnablePartitioningEnablePartitioning
PrefetchMultiplierPrefetchMultiplier
PrefetchCountPrefetchCount
TimeToWaitBeforeTriggeringCircuitBreakerTimeToWaitBeforeTriggeringCircuitBreaker
SubscriptionNameShortenerSubscriptionNamingConvention
SubscriptionNamingConventionSubscriptionNamingConvention
RuleNameShortenerSubscriptionRuleNamingConvention
SubscriptionRuleNamingConventionSubscriptionRuleNamingConvention
UseWebSocketsUseWebSockets
CustomTokenCredentialTokenCredential
CustomRetryPolicyRetryPolicy

Accessing the native incoming message

The Azure.Messaging.ServiceBus client SDK introduces a set of new classes to represent messages. Previously there was only the Message class to represent either an incoming message or an outgoing message. With the new client SDK the incoming message type is ServiceBusReceivedMessage. If access to the native incoming message is required, make sure the correct type is used. See the native message customization documentation for further details.

Native message customization

IMessageHandlerContext and IPipelineContext no longer need to be passed to the CustomizeNativeMessage method. See the native message customization documentation for further details.

Related Articles


Last modified