RabbitMQ Transport Upgrade Version 3 to 4

Component: RabbitMQ Transport

Connection string options

When upgrading, there are several connection string options that should be removed from any existing connection strings.

DequeueTimeout

The DequeueTimeout setting has been removed because the message pump no longer polls for incoming messages, so 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.

4.x NServiceBus.RabbitMQ
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.

4.x NServiceBus.RabbitMQ
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.PrefetchCount(100);

UsePublisherConfirms

The UsePublisherConfirms setting has been replaced by the following:

4.x NServiceBus.RabbitMQ
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, so 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

This 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.Callbacks NuGet package, the maximum concurrency is no longer separately controlled. The value passed to EndpointConfiguration.LimitMessageProcessingConcurrencyTo will be used for the callbacks queue in addition to the main queue.

4.x NServiceBus.RabbitMQ
endpointConfiguration.LimitMessageProcessingConcurrencyTo(10);
3.x NServiceBus.RabbitMQ
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 via the following:

4.x NServiceBus.RabbitMQ
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, so 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 UseDirectRoutingTopology method's exchangeNameConvention parameter's type was changed from Func<Address, Type, string> to Func<string, Type, string>.

Custom Routing Topology

The following changes have been made to the IRoutingTopology interface:

  • The interface's namespace was changed from NServiceBus.Transports.RabbitMQ.Routing to NServiceBus.Transport.RabbitMQ.
  • The Publish method's message parameter's type changed from TransportMessage to OutgoingMessage.
  • The Send method's message parameter's type changed from TransportMessage to OutgoingMessage.
  • The Send method's address parameter's type changed from Address to string.
  • The RawSendInCaseOfFailure method was added to allow for forwarding messages that cannot be deserialized to the error queue.

Related Articles


Last modified