Welcome to the third and final part of our series dedicated to Event-Driven Architecture. In the first part (click here to read part 1) we’ve learned about the concept of an event, the advantages and disadvantages of using events in your system, and, most importantly, how to start thinking in terms of events. In the second part (click here to read part 2) we made a deep dive into the topic of storing, propagating, and distributing events. Learned about the common tools (event brokers, event buses, event streams) and their application techniques.
In this article, we are going to step away from the practical aspects of event handling and discuss abstractions. In particular patterns that allow us to build scalable, robust systems, capable of high speed and high availability. We are talking about the fundamental patterns of EDA — Event Notification, Event-Carried State Transfer, Event Sourcing, and CQRS. This time we will not just analyze but also design a full-fledged architecture to show them in action.
Event notification
Let’s start with the most simple one. It’s called Event Notification and is probably familiar to most software developers.
In a nutshell, it’s a basic pub/sub operation.
Publisher raises an event when something significant happens ->
-> subscriber receives the event and decides what to do with it.
An important detail about event notification is that it typically contains only a minimal payload (like an event type and maybe an identifier).
Imagine we have a delivery service. A carrier scans a parcel in a hub to confirm pick-up. At this moment an event is raised in the system that informs that parcel status has changed. Most data about a parcel is already in the system, therefore an event contains only the basic information like new status and probably a timestamp.
This approach has one fundamental flaw. If the subscriber needs some extra data (which is usually the case) it costs an extra queries to the event publisher to fetch more details.
Event-Carried State Transfer
This flaw is covered by Event-Carried State Transfer pattern. Basically, it’s an event-driven approach where events carry all the necessary data for consumers to act without needing additional queries.Let’s say we create an auction app.







