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
NServiceBus version 8 introduces a new transport configuration API. Instead of the generic-based UseTransport
method, create an instance of the transport's configuration class and pass it to the UseTransport
method.
For example, instead of:
var transport = endpointConfiguration.UseTransport<MyTransport>();
transport.Transactions(TransportTransactionMode.ReceiveOnly);
var routing = t.Routing();
routing.RouteToEndpoint(typeof(MyMessage), "DestinationEndpoint");
Use:
var transport = new MyTransport{
TransportTransactionMode = TransportTransactionMode.ReceiveOnly
};
var routing = endpointConfiguration.UseTransport(transport);
routing.RouteToEndpoint(typeof(MyMessage), "DestinationEndpoint");
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.
Transport specific configuration
See the transport-specific upgrade guides for further details on the configuration options:
- Azure Service Bus transport upgrade guide
- Azure Storage Queues transport upgrade guide
- RabbitMQ transport upgrade guide
- MSMQ transport upgrade guide
- SQL Server transport upgrade guide
- Amazon SQS transport upgrade guide
Backwards-compatible API
The existing API transport configuration API is supported for this major version via a shim API. This shim API emulates the replaced configuration API surface but uses different types. Therefore, custom code that refers to the configuration API types might need to be updated to use the shim API types instead.
Transaction configuration
Instead of the Transactions
method, use the TransportTransactionMode
property on the transport configuration instance to configure the desired transaction mode.
var transportConfiguration = new MyTransport{
TransportTransactionMode = TransportTransactionMode.ReceiveOnly
};
endpointConfiguration.UseTransport(transportConfiguration);
Connection strings
Configuring a transport's connection using .
, which was removed for .NET Core in NServiceBus version 7, has been removed from all platforms in NServiceBus version 8. To retrieve the connection string by the named value in the configuration, first retrieve the connection string and then pass it to the transport configuration API.
A connection string named NServiceBus/
will no longer be detected automatically on any platform. The connection string value must be configured explicitly using .
.
Routing configuration
Routing can be configured on the RoutingSettings
object returned from the UseTransport
method.
var routing = endpointConfiguration.UseTransport(transportConfiguration);
routing.RouteToEndpoint(typeof(MyMessage), "DestinationEndpoint");
Subscription authorization
The SubscriptionAuthorizer
method is now available on the RoutingSettings
:
var routing = endpointConfiguration.UseTransport(transportConfiguration);
routing.SubscriptionAuthorizer(context => <...>);
Subscription Authorization is only available for transports using message-driven publish-subscribe
Renamed APIs
The following low-level transport APIs have been renamed:
IDispatchMessages
has been renamed toIMessageDispatcher
IReceiveMessages
has been renamed toIMessageReceiver
IManageSubscriptions
has been renamed toISubscriptionManager
Obsolete configuration options
The following configuration operations are obsolete in NServiceBus version 8. See the transport-specific upgrade guides for further information about the availablity of these configuration options.
EndpointConfiguration.
DoNotCreateQueues TransportExtensions.
ConnectionString
Queue creation can be controlled using the installer configuration.