Event-Driven Architecture (EDA)
Systems that react to events.
“Fire and forget.”
Decoupled communication.
graph LR
P[Producer] -->|Event| B[Broker/Bus]
B -->|Event| C1[Consumer 1]
B -->|Event| C2[Consumer 2]
When to use
- High Throughput.
- Loose Coupling.
- Asynchronous Workflows.
Explanation
Components publish “Events” (“OrderPlaced”) to a Bus. Consumers subscribe to events.
Pros and Cons
| Pros | Cons |
|---|---|
Code example
Typescript (Node.js EventEmitter)