Publishing domain events
Domain events are used to inform other components and services about an important change to a domain object so that they can take action.
ABP Framework provides two types of event buses to publish domain events, each with a different purpose:
- The local event bus is used to notify the handlers in the same process.
- The distributed event bus is used to notify the handlers in the same or different processes.
Publishing and handling events are pretty easy with ABP Framework. The next section shows how to work with the local event bus, and then we will look at the distributed event bus.
Using the local event bus
A local event handler is executed in the same unit of work (in the same local database transaction). If you are building a monolith application or want to handle events in the same service, the local event bus is fast and safe to use because it works in the same process.
Assume that you want to publish a local event when an...