rebus-org / Rebus.Autofac

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

Previous API allowed exposing RebusConfigurer #7

Closed ben-jacobs closed 6 years ago

ben-jacobs commented 6 years ago

Thanks for the changes allowing access to IComponentContext.

I must say though, I do prefer the existing approach. This allowed for exposing RebusConfigurer separately before the bus was created.

This allowed for the container to create the RebusConfigurer instance with all the default options and properties etc, but allowed for the Routing to be configured before creating the bus.

Since there's no option (as far as i know?) to mess with routing after the bus is created, this results in a lot of boilerplate code to configure the bus instead of creating it with the majority of options by IoC.

Am I missing some sort of option to configure routing after the bus is created?

ben-jacobs commented 6 years ago

Sorted ... I think.

Basically I'm now just allowing an IRouter configuration as a parameter into the Autofac builder - which I think it perfectly fine because once the bus is started, the configuration can't be changed anyway and there's no real benefit from getting access to it.

It'd be great to merge multiple IRouter configurations, but that's a job for another day.

mookid8000 commented 6 years ago

but allowed for the Routing to be configured before creating the bus

There's nothing that prevents you from collection all of your intended endpoint mapping somewhere else, e.g. in a simple Dictionary<Type, string> somewhere, and then pass it to the RegisterRebus configuration method (either via the container, or simply by capturing it in the closure of the Rebus configuration callback) 🙂