Closed jamshally closed 2 years ago
Wouldn't this be fairly easy to implement manually by keeping all routing information in a registry somewhere and then
IBusRegistry
extension methodthus keeping this entirely separate from Rebus/Rebus.ServiceProvider?
@mookid8000 - thanks for your reply. Good points. I see the benefit of keeping this capability segmented from the IBusRegistry (single responsibility principle and all that). I think I will try this approach you suggested and leverage an extension method. I'm happy to share/submit if I come up with something useful and reusable.
Side note - is is possible to query/inspect a Rebus Instance for its existing routes (which would avoid the need to develop and maintain a separate RouteRegistry).
Cheers
(..) is is possible to query/inspect a Rebus Instance for its existing routes (which would avoid the need to develop and maintain a separate RouteRegistry)
It isn't, which is why I suggest you implement this the other way around: Populate your own model of which bus instances should be available and which messages should be sent using those instances, and then use that model to configure the bus instances and actually select which bus instance should be used to send/publish each message.
I hope that made sense 🙂 Let me know if you need any more suggestions
Feature Request
It could be very useful if the IBusRegistry had a
Send(SomeCommand)
function, that would proxy a given command to the correct Rebus Instance (the one with the Routing configured for the Command).Use Case - Configurable Module Distribution
This would easily allow a modular system, through configuration only, to be deployed in arbitrary combinations of co-hosted and remotely hosted (distributed) services. For example, the following hosting modes could easily be achieved:
The application code would not need to care about where the various system modules are hosted. It can simply Send Commands (via the IBusRegistry) and they will be routed to the correct location (local or networked).
This approach would be massively helpful in supporting scenarios such as:
Notes
Thanks for this work on this library - the Rebus.ServiceProvider project is a great addition to the Rebus ecosystem - and the documentation page covering the various Rebus instance and lifecycle options has been massively helpful.