You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `EventProcessor` handles parallel or sequential processing based on configuration, and `EventEmitter` routes events to appropriate handlers or message brokers.
120
134
121
-
Events are processed through `EventDispatcher`, which finds registered handlers and executes them:
135
+
### 3. Event Processing via EventEmitter
136
+
137
+
Events are processed through `EventEmitter`, which routes them based on event type:
122
138
123
139
```mermaid
124
140
graph TD
125
-
A[EventDispatcher.dispatch] -->|1. Get Event Type| B[EventMap.get]
126
-
B -->|2. Find Handlers| C{Handlers Found?}
127
-
C -->|No| D[Log Warning]
128
-
C -->|Yes| E[Loop Through Handlers]
129
-
E -->|3. Resolve Handler| F[DI Container]
130
-
F -->|4. Execute Handler| G[Handler.handle]
131
-
G -->|5. Process Side Effects| H[Complete]
141
+
A[EventEmitter.emit] -->|1. Get Event Type| B{Event Type?}
142
+
143
+
B -->|DomainEvent| C[EventMap.get]
144
+
C -->|2. Find Handlers| D{Handlers Found?}
145
+
D -->|No| E[Log Warning]
146
+
D -->|Yes| F[Loop Through Handlers]
147
+
F -->|3. Resolve Handler| G[DI Container]
148
+
G -->|4. Execute Handler| H[Handler.handle]
149
+
H -->|5. Process Side Effects| I[Complete]
150
+
151
+
B -->|NotificationEvent| J{Message Broker?}
152
+
J -->|No| K[Raise RuntimeError]
153
+
J -->|Yes| L[Send to Message Broker]
154
+
L --> I
132
155
133
156
style A fill:#e1f5ff
134
-
style G fill:#c8e6c9
135
-
style H fill:#fff3e0
157
+
style H fill:#c8e6c9
158
+
style I fill:#fff3e0
136
159
```
137
160
138
-
### 4. Event Emission
161
+
### 4. Event Routing
162
+
163
+
`EventEmitter` automatically routes events based on their type:
139
164
140
-
After processing, events are emitted through `EventEmitter`:
165
+
-**DomainEvent** — Processed by event handlers registered in EventMap (in-process, synchronous)
166
+
-**NotificationEvent** — Sent to message broker (Kafka, RabbitMQ, etc.) for asynchronous processing
141
167
142
-
-**DomainEvent** — Processed by event handlers (in-process)
143
-
-**NotificationEvent**— Sent to message broker (Kafka, RabbitMQ, etc.)
168
+
!!! important "Single Processing"
169
+
Events are processed **only once**through EventEmitter. There is no duplicate processing - DomainEvents are handled by event handlers, and NotificationEvents are sent to message brokers.
0 commit comments