Skip to content
On this page

Interoperability with NServiceBus

Wolverine is the new kid on the block, and it's quite likely that many folks will already be using NServiceBus for messaging. Fortunately, Wolverine has some ability to exchange messages with NServiceBus applications, so both tools can live and work together.

At this point, the interoperability is only built and tested for the Rabbit MQ transport.

Here's a sample:

cs
Wolverine = await Host.CreateDefaultBuilder().UseWolverine(opts =>
{
    opts.UseRabbitMq()
        .AutoProvision().AutoPurgeOnStartup()
        .BindExchange("wolverine").ToQueue("wolverine")
        .BindExchange("nsb").ToQueue("nsb")
        .BindExchange("NServiceBusRabbitMqService:ResponseMessage").ToQueue("wolverine");

    opts.PublishAllMessages().ToRabbitExchange("nsb")

        // Tell Wolverine to make this endpoint send messages out in a format
        // for NServiceBus
        .UseNServiceBusInterop();

    opts.ListenToRabbitQueue("wolverine")
        .UseNServiceBusInterop()
        
        //.DefaultIncomingMessage<ResponseMessage>()
        
        .UseForReplies();
    
    // This facilitates messaging from NServiceBus (or MassTransit) sending as interface
    // types, whereas Wolverine only wants to deal with concrete types
    opts.Policies.RegisterInteropMessageAssembly(typeof(IInterfaceMessage).Assembly);
}).StartAsync();

snippet source | anchor

MORE SOON!

Released under the MIT License.