Event-Driven Architecture (EDA) is about using events as a way to communicate within a system. Generally, leveraging a message broker to publish and consume events asynchronously. The publisher is unaware of who is consuming an event and the consumers are unaware of each other. Event-Driven Architecture is simply a way of achieving loose coupling between services within a system.
An event is a data point that represents state changes in a system. It doesn't specify what should happen and how the change should modify the system, it only notifies the system of a particular state change. When a user makes an action, they trigger an event.
Event-driven architectures have three key components:
event-driven-architecture
Note: Dots in the diagram represents different events in the system.
There are several ways to implement the event-driven architecture, and which method we use depends on the use case but here are some common examples:
Note: Each of these methods is discussed separately.
Let's discuss some advantages:
Here are some challenges of event-drive architecture:
Below are some common use cases where event-driven architectures are beneficial:
Here are some widely used technologies for implementing event-driven architectures: