What is Event-Driven Architecture?
Event-Driven Architecture (EDA) is a design pattern for software systems that react to significant business activities or events, promoting loose coupling between components while allowing for greater flexibility and scalability. EDA empowers customers to build systems capable of handling a large number of events and messages, integrating various systems and services through a common event-driven interface.
For who can Event-Driven Architecture be interesting?
EDA is beneficial for customers with requirements to build systems that communicate asynchronously, are scalable, flexible, and loosely coupled. EDA is not limited to specific domains or providers; it can be utilized by any customer whose landscape comprises systems with the aforementioned characteristics that interact with each other.
Furthermore, this architectural pattern proves advantageous when dealing with:
- Events triggered by data when there is a state change in the source system or provider.
- Immutable events (changed or deleted events).
- Events that need to be ordered in the sequence of their creation. In this context, creation refers to the creation/update/deletion of an object, representing a change in its state.
- Handling a large number of transactions and events.
- Sending events across multiple target applications, systems, or consumers.
Technical deep dive of EDA
Below is a simple demonstration of EDA-design pattern:
The event broker plays a crucial role as an intermediary between providers and consumers. Providers are unaware of the consumers that subscribe to the events they publish, and likewise, consumers do not need to know the identity of the publisher or provider. When a change occurs in the source’s state, an event is triggered and published to a topic. Individual queues, listening to the topic, then subscribe to these events.
Certain tools facilitate filtering functionality, allowing different queues to fetch data based on specific interests, such as customer data region-wise. Remarkably, the requirement for the source and target to be operational simultaneously is eliminated. Even if the target system is temporarily down, the events are persisted in the queue and can resume once the target is back online. This loose coupling between the source and target systems enhances flexibility.
The design pattern ensures that every target application interested in a particular event receives it in the order it was triggered. If a need arises for an application to fetch data from multiple queues (e.g., retrieving available materials and their prices from Queue2 and Queue3), there is no need for additional development; simply adding a new consumer to the landscape suffices. This simplicity contributes to a scalable and flexible architecture.
EDA (Event-Driven Architecture) shares similarities with microservices, as it also offers agility. Within the EDA framework, microservices can act as either the source/publisher or the target/consumer, facilitating end-to-end delivery. The publisher can trigger an arbitrary number of events, or even publish entire event streams. Notably, each event is considered unique and sent only once by the broker to its respective consumers.
User cases and examples of EDA
Here are several use-cases where Event-Driven Architecture (EDA) would be a perfect fit:
- IoT Streaming
- Analyzing user visits to websites
- Financial trading systems (e.g., updating stock prices)
- Healthcare applications (e.g., triggering events when patient vital signs change)
- Anomaly detection using water sensors
- E-commerce scenarios (e.g., order status updates)
- Banking domain
- And more.
Event-Driven Architecture is a design pattern that can be employed in conjunction with microservices or independently, based on specific business requirements. EDA offers numerous advantages, including handling large transaction volumes, promoting loose coupling, ensuring scalability, agility, and building resilient systems. If maintaining the sequence of events is a crucial consideration, then EDA becomes the ideal approach to pursue.
Want to know more about EDA?
- Read more about Event-Driven Architectures, AsyncAPI and MuleSoft.
- Combining event-driven architecture principles with MuleSoft’s API-led connectivity approach.
- During The Software Engineering Tech Friday, we talked about the power of event-driven architectures and the Axon Framework.
If you have any questions or just want to know more? Please get in touch with us!