Event-driven architecture
Learning objectives
- You know the term event-driven architecture.
In the previous chapter, we explored a handful of opportunities for real-time communication. When considering server-sent events and web sockets, they both build on top of the idea of sending messages and reacting to the messages.
Events are passed, and events are reacted to.
Event-driven architecture is a design pattern focusing on producing and consuming events, which provides means for communicating between services without a need for the services being aware of each other. In other words, in an event-driven architecture, components responsible for creating events and components responsible for handling events are decoupled, and a mechanism is used for passing messages between the decoupled parts.
Event-driven architecture is present in a wide variety of applications. For example, in user interfaces, events such as pressing a button are typically decoupled from the functionality that processes the press of a button. This can be implemented using event or action listeners, which are used to register functionality that should be executed in the case of the events.