Open Closed

Switching Between LocalEventBus and DistributedEventBus in Microservice Architecture #9393


User avatar
0
viswajwalith created

ABP Framework version: v7.3.2 UI Type:MVC Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB Tiered (for MVC) or Auth Server Separated (for Angular): yes

Hi ABP Support Team,

Some of our clients prefer not to use any distributed messaging infrastructure (e.g., RabbitMQ or Kafka) in their environments. As a result, we would like to understand if it's feasible to completely exclude the DistributedEventBus dependency from our ABP-based microservice solution.

In this context:

Can we use LocalEventBus as a replacement for DistributedEventBus, particularly for intra-service communication in modules like Identity and SaaS, assuming they are hosted within the same process or closely coupled?

Is it possible to dynamically switch between LocalEventBus and DistributedEventBus based on a configuration setting (e.g., from appsettings.json) so the same codebase can support both environments (with or without distributed messaging)?

If this is supported, we would appreciate guidance on recommended practices or potential limitations.

Thank you for your support.


1 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Can we use LocalEventBus as a replacement for DistributedEventBus, particularly for intra-service communication in modules like Identity and SaaS, assuming they are hosted within the same process or closely coupled?

    Hi, for distributed systems (and microservices), it's suggested to use distributed events, because of the inter-service communication without tight coupling services to each other. If you don't have a requirement for that, then you can use the local event bus, but most of the time, it will probably not be feasible for development and you will require distributed events. (Unless, you want to tightly couple your services, and this breaks the microservices architecture, because you will not be able to independently deploy your services and so on..)

    Is it possible to dynamically switch between LocalEventBus and DistributedEventBus based on a configuration setting (e.g., from appsettings.json) so the same codebase can support both environments (with or without distributed messaging)?

    Unfortunately, there is no feature flag for that. But, if you use IDistributedEventBus by default, and switch its provider as LocalDistributedEventBus for a custom setting/option, then it will work like a local event bus. (By default, if you don't configure a provider it uses LocalDistributedEventBus by default and it works as a local event bus - in memory -)

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on June 13, 2025, 11:37