Skip to content

Migration v6 To v7

The v7 provider keeps the same ServiceBus.Core programming model as much as possible.

The main migration point is the RabbitMQ.Client channel abstraction.


Main Difference

Area v6 v7
Package ServiceBus.Core.Rabbit ServiceBus.Core.Rabbit.V7
RabbitMQ channel IModel IChannel
Descriptor model Same Same
Publisher model Same Same
Subscriber model Same Same

Package Change

v6:

dotnet add package ServiceBus.Core.Rabbit

v7:

dotnet add package ServiceBus.Core.Rabbit.V7

Channel Creation

v6:

var channel = connection.CreateModel();

v7:

var channel = await connection.CreateChannelAsync();

Keep Descriptors Stable

The descriptor configuration should remain mostly unchanged.

var descriptor = new PublisherBoundDescriptor
{
    Exchanges =
    {
        new ExchangeBoundDescriptor
        {
            Name = "orders",
            Type = ExchangeTypes.Direct,
            Durable = true
        }
    }
};

The same descriptor can represent the same topology regardless of whether the underlying provider uses IModel or IChannel.


Publisher Migration

v6:

var publisher = new PublisherBound(
    descriptor,
    formatter,
    model);

v7:

var publisher = new PublisherBound(
    descriptor,
    formatter,
    channel);

The conceptual construction stays the same.


Subscriber Migration

v6:

var subscriber = new SubscriberBound<OrderCreated>(
    descriptor,
    formatter,
    model);

v7:

var subscriber = new SubscriberBound<OrderCreated>(
    descriptor,
    formatter,
    channel);

Migration Strategy

Recommended approach:

  1. Keep descriptors unchanged.
  2. Replace RabbitMQ.Client v6 package references.
  3. Replace ServiceBus.Core.Rabbit with ServiceBus.Core.Rabbit.V7.
  4. Update channel creation from IModel to IChannel.
  5. Rebuild publishers and subscribers using the v7 channel.
  6. Run integration tests against RabbitMQ.

What Not To Change

Do not rewrite topology descriptors unless the topology itself changes.

Do not duplicate examples or configuration only because the provider version changes.

The version-specific difference should remain isolated in the composition root.