RabbitMQ Transport Upgrade Version 4 to 5

Component: RabbitMQ Transport
This page targets a pre-release version and is subject to change prior to the final release.

Mandatory routing topology selection

Specifying a routing topology is now mandatory. For backwards compatibility, the recommendation is to use the ConventionalRoutingTopology, which was the previous default.

See routing topology for further details.

Direct routing topology changes

The convention for overriding the name of the exchange used when publishing events has changed. The address and the event type are no longer passed to the exchangeNameConvention parameter of the UseDirectRoutingTopology method.

5-pre NServiceBus.RabbitMQ
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.UseDirectRoutingTopology(
    routingKeyConvention: type => "myroutingkey",
    exchangeNameConvention: () => "MyTopic");
4.x NServiceBus.RabbitMQ
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.UseDirectRoutingTopology(
    routingKeyConvention: type => "myroutingkey",
    exchangeNameConvention: (address, eventType) => "MyTopic");

Custom routing topology changes

The following changes have been made to the interfaces used to create custom routing topologies.

IDeclareQueues removed

The IDeclareQueues interface added in Version 4.2 has been removed. The two address parameters on the interface's DeclareAndInitialize method have been added to the Initialize method of the IRoutingTopology interface. Implementations of the Initialize method are now responsible for creating any queues required by the topology.

ISupportDelayedDelivery removed

The ISupportDelayedDelivery interface added in Version 4.3 has been removed. The BindToDelayInfrastructure method is now part of the IRoutingTopology interface.

Exchange and queue durability

Exchange and queue durability is no longer controlled by the global message durability settings specified for the endpoint. The routing topologies provided by the transport now create durable exchanges and queues by default. The UseDurableExchangesAndQueues setting has been introduced to control durability:

5-pre NServiceBus.RabbitMQ
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.UseDurableExchangesAndQueues(false);

If DisableDurableMessages has been called, the transport will throw an exception unless UseDurableExchangesAndQueues is also called:

5-pre NServiceBus.RabbitMQ
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
endpointConfiguration.DisableDurableMessages();
transport.UseDurableExchangesAndQueues(true);

Related Articles


Last modified