Skip to content

Enable Legacy Conventions

Atallah0 edited this page Aug 5, 2024 · 2 revisions

TL;DR

To enable the legacy type naming convention simply create the bus with LegacyTypeNaming() option:

For EasyNetQ v8.x:

var serviceCollection = new ServiceCollection();
serviceCollection.AddEasyNetQ("host=localhost").UseLegacyTypeNaming();
    
using var provider = serviceCollection.BuildServiceProvider();
var bus = provider.GetRequiredService<IBus>();

For EasyNetQ v7.x:

var bus = RabbitHutch.CreateBus("host=localhost", x => x.EnableLegacyTypeNaming());

To enable the legacy RPC convention simply create the bus with LegacyRpcConventions() option:

For EasyNetQ v8.x:

var serviceCollection = new ServiceCollection();
serviceCollection.AddEasyNetQ("host=localhost").UseLegacyRpcConventions();
    
using var provider = serviceCollection.BuildServiceProvider();
var bus = provider.GetRequiredService<IBus>();

For EasyNetQ v7.x:

var bus = RabbitHutch.CreateBus("host=localhost", x => x.EnableLegacyRpcConventions());

To enable both the legacy type naming convention and the legacy RPC convention simply create the bus with LegacyConventions() option:

For EasyNetQ v8.x:

var serviceCollection = new ServiceCollection();
serviceCollection.AddEasyNetQ("host=localhost").UseLegacyConventions();
    
using var provider = serviceCollection.BuildServiceProvider();
var bus = provider.GetRequiredService<IBus>();

For EasyNetQ v7.x:

var bus = RabbitHutch.CreateBus("host=localhost", x => x.EnableLegacyConventions());

Long story

Before v3 the queue and exchange name were something like this:

Exchange: EasyNetQ.Tests.TestPerformanceMessage:EasyNetQ.Tests.Common
Queue: EasyNetQ.Tests.TestPerformanceMessage:EasyNetQ.Tests.Common_consumer

The new format has become this:

Exchange: EasyNetQ.Tests.TestPerformanceMessage, EasyNetQ.Tests.Common
Queue: EasyNetQ.Tests.TestPerformanceMessage, EasyNetQ.Tests.Common_consumer

There isn't only the comma difference, to see all the differences check both serializers DefaultTypeNameSerializer >=v3 and LegacyTypeNameSerializer <=v2

Clone this wiki locally