rebus-org / Rebus.ServiceProvider

:bus: Microsoft Extensions Dependency Injection container adapter for Rebus
https://mookid.dk/category/rebus
Other
65 stars 32 forks source link

NullBus pattern #89

Closed olliejm closed 3 months ago

olliejm commented 3 months ago

Not sure if this is really something in the scope of the project but I have a use case where in a modular monolith type backend, I have a web application which initialises some services which should send event bus messages after certain operations, however I have some additional console applications which should make use of the same services but not send any event bus data. Therefore it would be useful for me to initialise a "NullBus" pattern where these services can still be used and their usages of Rebus functionality simply execute as no-ops. I've implemented a NullBus for this case but was just wondering mainly a) if it might be something already possible through the library that I missed, or b) whether a more full-fledged implementation of this pattern would be something that might come under the scope of the library. Thanks for the great library!

mookid8000 commented 3 months ago

Thanks for the kind words! 🙂

a) if it might be something already possible through the library that I missed, or b) whether a more full-fledged implementation of this pattern would be something that might come under the scope of the library.

Neither (a) nor (b) 😅 I mean, it's great that libraries (e.g. like Rebus) can do a lot of things, but explicitly adding support for NOT doing what it's supposed to do is out of scope IMO.

Happy to hear you found a nice way to solve it though. 🙂