rebus-org / Rebus.Autofac

:bus: Autofac container adapter for Rebus
https://mookid.dk/category/rebus
Other
12 stars 11 forks source link

RebusConfigurer instance from Autofac #15

Closed satyajit-behera closed 4 years ago

satyajit-behera commented 4 years ago

While using Autofac container, is it possible to get the rebusConfigurer instance as we get with BuiltInActivator?

Activator = new BuiltinHandlerActivator();
RebusConfigurer rebusConfigurer = Configure.With(Activator);
mookid8000 commented 4 years ago

What would you like to use it for?

satyajit-behera commented 4 years ago

To update configuration other than when I am doing the RegisterRebus. Thanks.

mookid8000 commented 4 years ago

When you RegisterRebus, the variable passed to you (configure in the snipped below) IS the RebusConfigurer:

var builder = new ContainerBuilder();

builder.RegisterRebus(
    configure => configure  //< this is the RebusConfigurer :)
        .Logging(l => l.Serilog())
        .Transport(t => t.UseRabbitMq(..., "autofac-test"))
        .Options(o => ...)
);

using (var container = builder.Build())
{
    // bus is running now   
}
satyajit-behera commented 4 years ago

Thanks. This approach looks good.