WorkerService configure a RabbitMq with MassTransit
Asked Answered
A

1

7

in a WorkerService .Net I am trying to configure a MassTransit host with RabbitMq but I am getting this Error

Reference to type 'IBusControl' claims it is defined in 'MassTransit', but it could not be found

IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context,services) =>
{
    services.AddHostedService<Worker>();

    services.AddAutoMapper(typeof(Program));
    //MassTransit-RabbitMQ Configuration
    services.AddMassTransit(config => {
        config.UsingRabbitMq((ctx, cfg) => {
            cfg.Host(context.Configuration.GetValue<string>("EventBusSettings:HostAddress"));
        });
    });
    services.AddMassTransitHostedService();
})
.Build();

await host.RunAsync();

What am I missing?

Albarran answered 27/5, 2022 at 9:53 Comment(0)
H
15

You are probably referencing an assembly that is not current. The latest version of MassTransit no longer requires the AddMassTransitHostedService configuration method. More details are available in the documentation.

Hooper answered 27/5, 2022 at 11:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.