Event Driven Architecture Guide
Event Driven Architecture Guide
Event-Driven Architecture
Table of Contents
Introduction 1
What is an Event? 5
Event-driven Applications 8
Summary 14
Codification © Event-Driven Architecture
Introduction
Modern applications created using microservices often use an event-driven
architecture, which uses events to initiate and facilitate communication between
disconnected services. An item added to a shopping basket on an e-commerce
website is an example of an event; which is a change in state or an update. Events
can either be identifiers or convey the state (the item purchased, its price, and a
delivery address) (a notification that an order was shipped).
Event-driven architectures are made up of three main parts: event producers, event
routers, and event consumers. An event is published by a producer and sent to the
router, which filters and sends it to consumers. Due to the decoupling between
producer and consumer services, each can be grown, modified, and deployed
separately.
1
Codification © Event-Driven Architecture
Event Consumer(s)
Subscribe Topic 1 Event consumers
Event Producer
Subscribe Topic 2 Event consumers
Topic 1
Event
Event
Topic 2 Subscribe Topic 3 Event consumers
3
Codification © Event-Driven Architecture
The prevention of data loss was given top emphasis in the service-oriented
approach, however. The main concern with event-driven architecture is making
sure you react to events as they happen. Events have a law of decreasing returns,
which means that as they age, their value decreases. Today, however, event-driven
architecture and service-oriented architecture are frequently used in tandem.
When you use an event-driven architecture, you have event producers that create
and send out event notifications, as well as one or more consumers that, when they
receive an event, start processing the event. Consider the scenario where a new
movie from Netflix has just been uploaded. Multiple programmes could be watching
or listening for that notice, which would then cause their systems to tell their users
about what happened. Applications continue to run, and even if they are listening for
this event, they don’t stop doing anything while they wait for it. This is different from
normal request-response messaging in that applications don’t stop doing anything
while they wait. When the message is published, they can also reply. As a result,
numerous services may operate concurrently.
4
Codification © Event-Driven Architecture
What is an Event?
Any noteworthy occurrence or state change for system software
or hardware is referred to as an event. A message or notice
provided by the system to inform another component of the
system that an event has occurred is not the same thing as an
event.
5
Codification © Event-Driven Architecture
To illustrate further, someone might buy something, someone else might check in
for a flight, or a bus might be running late. And no matter what industry one is in,
events are everywhere and happen all the time. They are present in every business.
An event is something that generates a message through production, publication,
detection, or consumption. Since the message is the travelling notification that
conveys the occurrence, the message and the event are distinct from one another.
An event in an event-driven architecture is likely to cause one or more actions or
processes to run in response to it. An instance of an event could be:
When an event notification is given, the system records that something happened,
such as a change in status, and then waits to respond to whoever needs it, whenever
they request it. This is known as event-driven architecture. The programme that
got the message has two options: it can reply right away, or it can hold off until the
desired state change has taken place.
Digital business applications can be made more flexible, scalable, contextual, and
responsive by using applications built on an event-driven architecture.
6
Codification © Event-Driven Architecture
Let’s examine a case in point. If you are a retailer, you may be compiling all of the
transactions that take place at all of your locations throughout the globe. You
transmit them to a credit card processor or whichever subsequent actions are
required, or you feed them into your event-driven architecture, which is keeping an
eye out for fraud. A manufacturer can monitor events in real-time and take actions,
such as predicting failures or planning maintenance, based on the data that is coming
off their equipment, which tells them facts like temperature and pressure.
Return Question
about stock
Point-of-sale Customer realtions
A customer returns an item The events trigger the
in person at the store. customer team to respond
to the order and inquiry. 7
Codification © Event-Driven Architecture
Event-Driven Applications
Applications can react to data as it is generated using an event-driven architecture.
The growth of data sources that produce events (like IoT sensors) and the creation
and acceptance of event-streaming technologies like Hazelcast Jet and Apache
Kafka® have contributed to the event-driven approach’s recent popularity. Instead
of focusing on a few indicators in a weekly or quarterly report, businesses can use
the event-driven approach to view operations and data as ongoing events.
Let’s take the fictional characters Jason and Natalie, who have lived in several places,
as an example. If we used a traditional batch-based method with data updates to
look up their address, we would see their address as it is right now.
We are still able to ask, “What is Jason and Natalie’s address right now?” using an
event-driven architecture.
Additionally, we could inquire as to where the address Jason and Natalie lived in
2014 was.
Alternatively, “What was Natalie’s previous address before she shared one with
Jason?”
Event-driven applications are often used for the Internet of Things (IoT), detecting
fraud, processing payments, monitoring websites, and real-time marketing, among
other things. Data is frequently treated as immutable, or unchangeable, in event-
driven applications, which makes it simple to search for the values of data from
earlier times. As a result, anytime information “changes,” a new data point with a new
time period is formed.
Not every event requires the application to take action. Think about the situation
of IoT sensor data. There may be millions of non-anomalous events in an application
that scans sensor data for anomalies, but none of these events ever cause the
application to take any action.
8
Codification © Event-Driven Architecture
9
Codification © Event-Driven Architecture
Further outcomes:
Your services are isolated from one another and are only aware of the event router
as a result. As a result, even if one of your services fails, the others will continue to
function. This means that your services are interoperable. An elastic buffer that can
adapt to increases in workload is what the event router does.
2. Agile development
The event router will automatically filter and push events to consumers; you no
longer need to create custom codes to poll, filter, and route events. Additionally,
the router eliminates the need for intensive coordination between producer and
consumer services, accelerating your development cycle.
3. Easy auditability
An event router serves as a central hub for defining policies and conducting
application audits. These policies can limit who can publish to and subscribe to a
router as well as manage who and what resources are allowed access to your data.
Additionally, you can encrypt events both in transit and at rest.
4. Saving costs
10
Codification © Event-Driven Architecture
Pub/sub model
This messaging system is built around event stream subscriptions. With this
strategy, subscribers who need to be informed are notified after an event occurs
or is published.
Events are logged using an event streaming approach. An event stream is not
subscribed to by event consumers. Instead, they are free to join the stream at any
time and read from any point within it.
Event stream processing ingests events and processes or transforms the event
stream using a data streaming platform, such as Apache Kafka. Meaningful
patterns in event streams can be found via event stream processing.
11
Codification © Event-Driven Architecture
Using an event-driven design, systems can You can use an event-driven architecture
be coordinated among teams working in to monitor and receive notifications on
and deploying across multiple locations and any abnormalities, changes, and updates
accounts. You can independently create, rather than constantly checking on your
scale, and deploy services by using an event resources. These resources may comprise
router to transport data between systems. computing nodes, serverless functions,
database tables, storage buckets, and more.
12
Codification © Event-Driven Architecture
Your event source’s resilience. If you need to process every single event, your
event source needs to be dependable and offer delivery guarantees.
Your needs for performance control. You should be able to manage the
asynchronous nature of event routers in your application.
You’re tracking the event flow. An event-driven architecture’s indirection allows
dynamic tracking through monitoring services but not static tracking through
code analysis.
Your event source’s data. Your event source should be deduplicated and sorted if
you need to rebuild the state.
13
Codification © Event-Driven Architecture
Summary
Let’s summarise the several essential event-driven architecture tenets:
Make sure the right “things” receive the right events using event brokers (creating
an event mesh).
Use topics to ensure that you send and receive only the information you require
(event filtering).
Use deferred execution with event broker persistence to let consumers process
events when they’re ready.
Keep in mind that this indicates that not everything is current (eventual
consistency).
To further distinguish the many components of a service, use topics (command
query responsibility segregation).
14
Codification © Event-Driven Architecture
About Codification
Codification is a Cloud Native transformation consultancy, with a team of over 100 engineers,
consultants and business professionals distributed across the world. We were founded in 2019
in the United Kingdom. We have grown since then to have a presence in Europe, the Middle East
and Asia, serving leading multinational corporations, government institutions, global banks, and
industry giants with our consultancy and expertise.
Through our experience, we have noticed that visionary leaders want to transform their
organisations into technology companies to thrive in the new digital-first economy. Here,
businesses want to release software faster, improve quality and build a continuous improvement
culture where the best ideas win. At Codification, we establish the direction of a company’s
technological transformation journey and help implement new technologies and processes,
resulting in a modernised digital-ready organisation.