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
Transports
- Upgrade AmazonSQS Transport Version 5 to 6
- MSMQ Transport Upgrade Version 1 to 2
- RabbitMQ Transport Upgrade Version 6 to 7
- SQL Server Transport Upgrade Version 6 to 7
Persistence
Timeout manager
The timeout manager is removed from core which makes timeout manager backwards compatibility mode obsolete. If backwards compatibility mode was enabled these APIs must be removed.
Configuring RabbitMQ Transport
To use the RabbitMQ transport for NServiceBus, create a new instance of the RabbitMQTransport
and pass it to EndpointConfiguration.
.
Instead of
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.ConnectionString(connectionString);
Use:
var transport = new RabbitMQTransport(Topology.Conventional, connectionString);
endpointConfiguration.UseTransport(transport);
The mandatory configuration settings, the topology and the connection string, are now required to construct the instance of the transport definition class.
Certificate path and passphrase
Certificate file path and passphrase can now be only passed via the connection string. When configuring secure connection via API the only option is to pass an instance of the X505Certificate2
class. This instance can be constructed using path and passphrase.
Instead of this code:
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.SetClientCertificate("path", "password");
Use this:
var transport = new RabbitMQTransport(Topology.Conventional, "host=localhost")
{
ClientCertificate = new X509Certificate2("path", "password")
};
endpointConfiguration.UseTransport(transport);
Prefetch count
The two prefetch count settings have been replaced with a single one that uses a callback. Instead of either of these APIs:
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.PrefetchCount(100);
//or
transport.PrefetchMultiplier(7);
Use one of these:
var transportWithFixedPrefetchCount = new RabbitMQTransport(Topology.Conventional, "host=localhost")
{
PrefetchCountCalculation = _ => 100
};
endpointConfiguration.UseTransport(transportWithFixedPrefetchCount);
//or
var transportWithConcurrencyBasedPrefetchCount = new RabbitMQTransport(Topology.Conventional, "host=localhost")
{
PrefetchCountCalculation = concurrency => concurrency * 7
};
endpointConfiguration.UseTransport(transportWithConcurrencyBasedPrefetchCount);
Disabling the durable exchanges and queues
Disabling the durable exchanges and queues has been moved to the constructor of the topology classes, ConventionalRoutingTopology
and DirectRoutingTopology
. In order to set the value of that parameter use the variant of the RabbitMQTransport
constructor that accepts an instance of the topology.
Configuration Options
The RabbitMQ transport configuration options that have not been changed have been moved to the RabbitMQTransport
class. See the following table for further information:
Version 6 configuration option | Version 7 configuration option |
---|---|
CustomMessageIdStrategy | MessageIdStrategy |
DisableRemoteCertificateValidation | ValidateRemoteCertificate |
SetClientCertificate | ClientCertificate |
SetHeartbeatInterval | HeartbeatInterval |
SetNetworkRecoveryInterval | NetworkRecoveryInterval |
TimeToWaitBeforeTriggeringCircuitBreaker | TimeToWaitBeforeTriggeringCircuitBreaker |
UseExternalAuthMechanism | UseExternalAuthMechanism |