From 3797ad11b3fd004484d44e0b17c5518e3352a0aa Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 30 May 2023 16:50:21 +0300 Subject: [PATCH] Add `Event Tracking and Logging` section to distributed event bus document --- docs/en/Distributed-Event-Bus.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/en/Distributed-Event-Bus.md b/docs/en/Distributed-Event-Bus.md index f1b8464d59..52bfa9aa3a 100644 --- a/docs/en/Distributed-Event-Bus.md +++ b/docs/en/Distributed-Event-Bus.md @@ -185,6 +185,28 @@ If you perform **database operations** and use the [repositories](Repositories.m > The handler class must be registered to the dependency injection (DI). The sample above uses the `ITransientDependency` to accomplish it. See the [DI document](Dependency-Injection.md) for more options. +## Event Tracking and Logging + +It is possible to be informed when the ABP Framework **receives** or **sends** a distributed event. The framework automatically **logs** all distributed events to the standard [logger](https://docs.abp.io/en/abp/latest/Logging), but you may require additional functionality. + +### Received events + +The `DistributedEventReceived` local event is published when your application receives a distributed event from the event bus. `DistributedEventReceived` class has the following fields: + +- **`Source` (`DistributedEventSource`):** It represents the source of the distributed event.. Source can be `Inbox`, `Outbox`, `Direct`. +- **`EventName` (`string`):** It represents the name of the event received. +- **`EventData` (`object`):** It represents the actual data associated with the event received. Since it is of type `object`, it can hold any type of data. + +### DistributedEventSent + +The `DistributedEventSent` local event is published when your application sends a distributed event to the event bus. `DistributedEventSent` class has the following fields: + +- **`Source` (`DistributedEventSource`):** It represents the source of the distributed event.. Source can be `Inbox`, `Outbox`, `Direct`. +- **`EventName` (`string`):** It represents the name of the event received. +- **`EventData` (`object`):** It represents the actual data associated with the event received. Since it is of type `object`, it can hold any type of data. + +You can seamlessly integrate event-tracking capabilities into your application by subscribing the `DistributedEventReceived` and `DistributedEventSent` local events. This empowers you to effectively monitor the messaging flow, diagnose any potential issues, and gain valuable insights into the behavior of your distributed messaging system. + ## Pre-Defined Events