Pontus Ekengren
Pontus Ekengren

Reputation: 77

Hosting nservicebus with .net6

NServiceBus is supported in .net6

According to the hosting docs and .net3.1 WebAPI-sample hosting can be done with

var host = Host.CreateDefaultBuilder()
    .UseNServiceBus(context =>
    {
        var endpointConfiguration = new EndpointConfiguration("Samples.ASPNETCore.Sender");
        var transport = endpointConfiguration.UseTransport<LearningTransport>();
        transport.Routing().RouteToEndpoint(
            assembly: typeof(MyMessage).Assembly,
            destination: "Samples.ASPNETCore.Endpoint");

        endpointConfiguration.SendOnly();

        return endpointConfiguration;
    })
    .ConfigureWebHostDefaults(c => c.UseStartup<Startup>())
    .Build();

Microsoft of course have a guide on how to migrate from 3.1 to 6

But my knowledge seem to fall short as I fail to convert and host NServiceBus correctly in .net6. Any suggestions would be much appreciated.

Upvotes: 1

Views: 1068

Answers (1)

Dennis van der Stelt
Dennis van der Stelt

Reputation: 2178

As you mentioned in the comments, I have a demo called EventualConsistencyDemo that belongs to this presentation.

I just updated the code and you can find the code for the website here and for a background (console) application here.

Also Jimmy Bogard updated his demos to .NET 6 and you can find the code here.

Upvotes: 2

Related Questions