TubeSum ← Transcribe a video

Event-Driven Architecture: Explained in 7 Minutes!

0h 07m video Published Apr 14, 2023 Transcribed Aug 2, 2026 A Alex Hyett
Intermediate 7 min read For: Software developers and architects with basic knowledge of microservices.
AI Trust Score 70/100
⚠️ Average / Some Fluff

"Delivers a solid, concise explanation of EDA in 7 minutes, though it's more of an overview than a deep dive."

AI Summary

This video explains event-driven architecture (EDA), a leading pattern for microservices communication. It contrasts EDA with API-driven and message-driven approaches, details its core components (producer, broker, consumer), and outlines its benefits and trade-offs, including scalability and eventual consistency.

[00:01]
Introduction to Event-Driven Architecture

EDA is a leading pattern for microservices, offering benefits over API-driven architecture. Services communicate via events rather than direct API calls.

[00:13]
Messages vs. Events

Messages are commands with instructions (e.g., send email), while events are notifications that something has happened, without instructions. Messages are deleted after processing; events are immutable records.

[01:32]
Event Broker and Pub/Sub Model

An event broker manages event distribution. Services subscribe to the broker, specifying interest in certain events. This is the publisher-subscriber (pub/sub) model.

[02:11]
Three Core Components

EDA has three main components: producer (publishes events), broker (manages which subscribers get which events), and consumer (subscribes to receive events).

[02:24]
Use Cases for EDA

EDA is best for processes that can run asynchronously, such as auditing, sending emails after orders, and data processing (e.g., feeding data to ML algorithms).

[03:06]
Advantages: Decoupling and Reliability

EDA decouples components; publishers don't know subscribers. This increases reliability—if a subscriber goes down, the publisher is unaffected.

[04:01]
Dependency Inversion and Reusability

EDA supports dependency inversion: both publisher and subscriber depend on the abstraction of events, allowing reuse and replacement of implementations.

[04:27]
Scalability

EDA scales easily: as event volume increases, more subscribers can be spun up to process them, without slowing the publisher.

[04:41]
Disadvantages: Data Consistency

EDA introduces eventual consistency—a delay between event publication and subscriber processing. This can cause issues like overselling stock or missing recent orders.

[05:52]
Duplicate Events and Idempotency

Subscribers may receive duplicate events after downtime. They must be idempotent, using unique event IDs to avoid processing the same event twice.

[06:32]
Complexity and Debugging

EDA adds complexity with more components, making systems harder to build and debug. It's not worth it if you don't have scaling problems.

Event-driven architecture offers significant benefits in decoupling, reliability, and scalability, but it comes with trade-offs like eventual consistency, duplicate events, and increased complexity. It's a powerful pattern when used appropriately for asynchronous, scalable systems.

Mentioned in this Video

Study Flashcards (5)

What is the main difference between a message and an event in event-driven architecture?

easy Click to reveal answer

A message is a command with instructions, while an event is a notification that something has happened, without instructions.

00:13

What are the three core components of event-driven architecture?

easy Click to reveal answer

Producer, broker, and consumer.

02:11

What is the publisher-subscriber model?

medium Click to reveal answer

A model where services subscribe to an event broker, which pushes relevant events to them.

01:32

What is eventual consistency in EDA?

medium Click to reveal answer

The delay between when an event is published and when subscribers process it, meaning data may be temporarily inconsistent.

04:41

Why must subscribers be idempotent in EDA?

hard Click to reveal answer

To handle duplicate events that may occur after downtime, ensuring they don't process the same event twice.

05:52

💡 Key Takeaways

💡

Messages vs. Events

Clarifies a fundamental distinction that is often confused.

00:13
⚖️

Decoupling and Reliability

Highlights a key advantage of EDA over API-driven architecture.

03:06
📊

Eventual Consistency Trade-off

Explains a critical trade-off that can cause real-world problems.

04:41
🔧

Idempotency Requirement

Emphasizes a practical implementation detail for handling duplicates.

05:52

[00:01] so one of the leading patterns that we use for microservices is what we call event driven architecture event driven architecture has many benefits over the API driven architecture and we're going to have a look at those today so when we

[00:13] different microservices you need a way for them all to talk to each other one way to do this is with messages we can have one service that adds a message to that listens to that queue and then acts on it when it receives it this is what

[00:27] and it does differ slightly from the event driven architecture that we're looking at today the main difference is that in event driven architecture our service will send an event after the event has happened the service raising

[00:39] after the event has been raised it doesn't care whether there's another state has changed in your application then an event is raised the event might be someone logging into your application or they might be performing a certain

[00:52] action the key here is that the service that's raising the event isn't reliant still work without it the event themselves are slightly different to messages as well a message is usually a command to do something it is designed

[01:06] instructions on what needs to be done this could be sending an email for example or running some other back-end process with an event there's not usually any instructions it's just information on what has been performed

[01:19] handled are slightly different as well with messages once a message has been processed is then deleted from the queue ready for the next message to come along events on the other hand are immutable they can't be changed they can't be

[01:32] of what's happened in your application so we now have a service that is the other services to respond to them we do this using an event broker your other services subscribe to this event broker and the broker is responsible for

[01:46] pushing events out to the Subscribe services this is often referred to as the publisher subscriber model or Pub sub for short when a service subscribes to the event broker they specify which events they are interested in it is then

[01:59] the brokers responsibility to work out which events the services are received this is usually done with a checkpoint so in an event-driven architecture there's three main components there's the producer which publishes the events

[02:11] the broker which manages which subscribers get which events and finally there's the consumer which subscribes to the event broker to receive the events now that we've got a good idea of what event driven architecture is let's have

[02:24] it event driven architecture is used best when a process can be run consequence on the application raising the events this can be really useful for things like auditing where you need to order every single action that the user

[02:39] does but the application itself doesn't need to know about the audit Trail or be run asynchronously such as maybe sending an email after someone's ordered something it's not usually critical that the customer gets their order email

[02:52] can be a couple of minutes late and it doesn't matter too much event driven architecture is also very good for data processing if if you've got a lot of application and you want to feed that into another system then you can do that

[03:06] really useful for training a machine learning algorithm based off of data have a look at some of the advantages of using event driven architecture as it does have quite a few benefits over the typical API driven model the first is it

[03:21] that decouples your components as the publisher doesn't need to know anything subscribing to its events they are completely decoupled from each other not only that but other services can be created they can subscribe to the same

[03:34] events all without the publisher needing to know compare this to one service calling another service over an API service one is now highly coupled to service two it needs to know how to call the API and what API contractor use the

[03:47] system is also less reliable if service 2 goes down then service one doesn't service 2 can go offline without affecting service one and then when then pick up where it left off the next benefit is that event driven

[04:01] dependency inversion the publishing service isn't dependent on any of the components aren't dependent on the publishing service both components are dependent on an abstraction which in this case is the events being raised as

[04:15] each service is dependent on an abstraction it allows you to reuse them as well as replace them with a different implementation without the other services being affected now the main benefit of event driven architecture is

[04:27] number of events being published increases then you can easily spin up more subscribers to process them you can also add more functionality such as auditing or data processing without slowing down the publishing service as

[04:41] with all things it's not a Clear Choice event driven architecture does have a need to be aware of the main issue is around data consistency when you're always going to be a delay between when the event is published and when your

[04:55] one of the trade-offs that you have to put up with if you want schedule ability delay by making sure that you've got enough subscribers to keep up with the events being published of course if they fall behind then there's going to be a

[05:09] between a service publishing an event and a subscriber picking up is minuscule is in the order of milliseconds but of course if your subscribers start falling increase and it might start to become noticeable by your users we call this

[05:25] going to be eventually consistent with what's being published however if you're not careful then eventual consistency can cause problems for the users using running an e-commerce site and you use an event-based system to manage the

[05:40] stock numbers as the system is eventually consistent this could allow two people to order the lowest item in stock or for example if you're using it to keep a history of the past orders a user could order something and then go

[05:52] their latest order won't be there if you're thinking about using an event-based system for scalability then sometimes you need to introduce a layer could store some information temporarily so that users aren't affected by any

[06:05] delays the second disadvantage for an event-based system is around duplicate keep a checkpoint however for performance reasons they don't keep a receive which means if your service goes offline when it comes back up it will

[06:19] checkpoint but it might end up receiving a few duplicate events as well you therefore need to make sure that your subscribers are item potent there is usually a unique ID on each of your events that can then be used by your

[06:32] servers to make sure you don't process the same event twice lastly event driven architecture like most systems designed for scalability is going to be a lot more complex you now have more components that you need to build and

[06:44] requirements on top of that your system is going to be a lot harder to debug when you do have problems arise all of these disadvantages are worth keeping in event based system if you're not having scaling problems at the moment and you

[06:58] don't foresee having them then chance an event driven architecture isn't worth more about software architecture you might like to watch this video on the microservice and which one you should pick thank you for watching this video

[07:10] please subscribe if you haven't already and I'll see you in the next video

More from Alex Hyett

View all

⚡ Saved you 0h 07m reading this? Transcribe any YouTube video for free — no signup needed.