This is part of the NServiceBus Upgrade Guide from Version 5 to 6, which also includes the following individual upgrade guides for specific components:
Feature Details
- Assembly Scanning Changes in NServiceBus Version 6
- No Async Suffix
- Dependency Injection Changes in NServiceBus Version 6
- Deprecated TransportMessage in NServiceBus Version 6
- Endpoint API changes in NServiceBus Version 6
- Extension Seam Changes in NServiceBus Version 6
- Migrate handlers and sagas to Version 6
- Header API changes in NServiceBus Version 6
- Messaging Changes in NServiceBus Version 6
- Moving away from IBus in Version 6
- Recoverability Changes in Version 6
- Serialization Changes in NServiceBus Version 6
- Subscription Changes in NServiceBus Version 6
- Transaction Configuration Changes in NServiceBus Version 6
Transports
- Azure Service Bus Transport (Legacy) Upgrade Version 6 to 7
- RabbitMQ Transport Upgrade Version 3 to 4
- SQL Server Transport Upgrade Version 2 to 3
- SQL Server Transport Upgrade - Supporting Unicode in Headers
Persistence
- Upgrade from NServiceBus Azure Version 6
- NHibernate Persistence Upgrade Version 6 to 7
- NHibernate Persistence - Resolving incorrect timeout table indexes
- RavenDB Persistence Upgrade from 3 to 4
Hosting
Other
- Moving to the DataBus AzureBlobStorage Package
- Azure Cloud Services Host Upgrade Version 6 to 7
- NServiceBus.Azure package deprecated
- Gateway Upgrade Version 1 to 2
- NServiceBus Testing Upgrade Version 5 to 6
- Callback Changes in NServiceBus Version 6
- Migrating the distributor to use sender-side distribution
- Tool and Helper Changes in NServiceBus Version 6
Connection string options
When upgrading, there are several connection string options that should be removed from existing connection strings.
DequeueTimeout
The DequeueTimeout
setting has been removed because the message pump no longer polls for incoming messages; there is no need for a timeout on how long it should block while waiting for a new message.
PrefetchCount
The consumer prefetch count is no longer controlled by the PrefetchCount
setting. Instead, the prefetch count is calculated by setting it to a multiple of the maximum concurrency value. The multiplier used in the calculation can be changed.
endpointConfiguration.LimitMessageProcessingConcurrencyTo(10);
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
// Prefetch count set to 10 * 4 = 40
transport.PrefetchMultiplier(4);
Alternatively, the calculation can be overridden and prefetch count can be set directly.
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.PrefetchCount(100);
UsePublisherConfirms
The UsePublisherConfirms
setting has been replaced by the following:
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.UsePublisherConfirms(true);
MaxWaitTimeForConfirms
The MaxWaitTimeForConfirms
setting has been removed because the transport no longer requires a timeout for how long it should block while waiting for publisher confirmation messages.
Callback support
Callbacks are no longer directly managed by the RabbitMQ transport. The settings related to the callback receiver queue have been removed.
DisableCallbackReceiver
This setting has been removed because the RabbitMQ transport no longer directly creates a callback receiver queue.
CallbackReceiverMaxConcurrency
The CallbackReceiverMaxConcurrency
setting has been removed because the RabbitMQ transport no longer directly creates a callback receiver queue. When callbacks have been enabled by installing the NServiceBus.
NuGet package, the maximum concurrency is no longer separately controlled. The value passed to EndpointConfiguration.
will be used for the callbacks queue in addition to the main queue.
// For RabbitMQ Transport version 4.x
endpointConfiguration.LimitMessageProcessingConcurrencyTo(10);
// For RabbitMQ Transport version 3.x
var transport = busConfiguration.UseTransport<RabbitMQTransport>();
transport.CallbackReceiverMaxConcurrency(10);
Providing a custom connection manager
The ability to provide a custom connection manager via the IManageRabbitMqConnections
interface has been removed. Connections are now managed internally by the transport in a way that is not extensible.
Controlling behavior when the broker connection is lost
The XML configuration options for controlling lost connection behavior have been removed.
TimeToWaitBeforeTriggering
The TimeToWaitBeforeTriggering
setting can now be configured as follows:
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.TimeToWaitBeforeTriggeringCircuitBreaker(TimeSpan.FromMinutes(2));
DelayAfterFailure
The DelayAfterFailure
setting has been removed because the message pump no longer polls for incoming messages; there is no inner loop that needs to pause when a connection failure is detected.
Routing topology
The changes to the RabbitMQ transport's routing topologies are listed below.
Direct routing topology
The type for the UseDirectRoutingTopology
method's exchangeNameConvention
parameter was changed from Func
to Func
.
Custom routing topology
The following changes have been made to the IRoutingTopology
interface:
- The interface's namespace was changed from
NServiceBus.
toTransports. RabbitMQ. Routing NServiceBus.
.Transport. RabbitMQ - The type for the
Publish
method'smessage
parameter changed fromTransportMessage
toOutgoingMessage
. - The type for the
Send
method'smessage
parameter changed fromTransportMessage
toOutgoingMessage
. - The type for the
Send
method'saddress
parameter changed fromAddress
tostring
. - A
RawSendInCaseOfFailure
method was added to allow for forwarding messages that cannot be deserialized to the error queue.