Skip to content

Commit 2a5ba67

Browse files
committed
Reword the Event Mesh flow of the Architecture chapter
1 parent 5c2c042 commit 2a5ba67

File tree

2 files changed

+46
-13
lines changed

2 files changed

+46
-13
lines changed

documentation/modules/ROOT/pages/01-pattern.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Cabs is a fictional transportation company. Engineers at Cabs were struggling
44
with their transactional-style, monolith application. They recently
55
started an effort to modernize it.
66

7-
The team saw a recent https://www.youtube.com/watch?v=Rc5IO6S6ZOk[talk on _Event Mesh_].
7+
The team saw a https://www.youtube.com/watch?v=Rc5IO6S6ZOk[talk on _Event Mesh_].
88
The talk presented the advantages of moving beyond transactional architectures
99
in favor of eventual consistency. By leveraging event meshes with technologies
1010
like Knative, developers can achieve decoupled, reliable microservices without

documentation/modules/ROOT/pages/02-architecture.adoc

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Here's the list of technologies used in this solution and its examples:
2121
** https://www.redhat.com/en/technologies/cloud-computing/openshift[Red Hat OpenShift]
2222
— Orchestrate containerized applications. Based on https://kubernetes.io/[Kuberentes].
2323
** https://www.redhat.com/en/technologies/cloud-computing/openshift/serverless[Red Hat OpenShift Serverless]
24-
— Provides the _Event Mesh_ and _Serverless_ capabilities. Based on https://knative.dev[Knative].
24+
— Provides the _Event Mesh_ and _Serverless_ capabilities. Based on https://knative.dev[Knative] project.
2525
** https://swc.saas.ibm.com/en-us/redhat-marketplace/products/red-hat-amq[Red Hat AMQ Streams]
26-
— (Optional) Provides a persistence for _Event Mesh_, likely needed in production. Based on https://strimzi.io/[Strimzi].
26+
— (Optional) Provides a persistence for _Event Mesh_, likely needed in production. Based on https://strimzi.io/[Strimzi] project.
2727
* Other open source technologies:
2828
** https://cloudevents.io/[CloudEvents] — Provides a standard for event metadata
2929
** Rust and https://access.redhat.com/products/quarkus[Quarkus] — Implementation examples.
@@ -49,9 +49,10 @@ destination, the system should reliably capture this real-world event, irrespect
4949
of any potential operational disruptions affecting dependent services (e.g.,
5050
invoicing).
5151

52-
In such scenarios, transactional applications typically return an error, resulting
53-
in an adverse user experience and a deviation from the genuine business process,
54-
potentially leading to customer dissatisfaction.
52+
In such scenarios, transactional applications typically return an error, which
53+
prevents any data from being changed, and causes the loss of real-world intent
54+
of end-users. This results in an adverse user experience and a deviation from
55+
the genuine business process, potentially leading to customer dissatisfaction.
5556

5657
=== Solution Breakdown
5758

@@ -60,10 +61,11 @@ dispatching commands, as events, lies at the heart of this solution. This
6061
approach aligns closely with the Command Query Responsibility Segregation
6162
(_CQRS_) pattern, which distinctly categorizes commands and queries. Commands,
6263
in this context, are modeled as asynchronous events, designed to undergo
63-
processing by the _Event Mesh_. On the other hand, queries are synchronous operations, safe to retry, ensuring
64-
no loss of data integrity due to transient errors.
64+
processing by the _Event Mesh_. On the other hand, queries are synchronous
65+
operations, safe to retry, ensuring no loss of data integrity due to transient
66+
errors.
6567

66-
The primary responsibility of the _Event Mesh_ is twofold: firstly, it persists
68+
The primary responsibility of the _Event Mesh_ is twofold. Firstly, it persists
6769
the incoming events, thereby maintaining a record of changes in the system's
6870
state. Secondly, it routes these events to their respective endpoints, ensuring
6971
that the appropriate microservices are notified and can subsequently update
@@ -96,12 +98,39 @@ benefits are achieved:
9698
persistence, ensures that critical state changes are propagated swiftly and
9799
reliably, thereby improving the overall user experience.
98100

101+
* **Improved business alignment**:
102+
By embracing an eventual consistency model, the _Event Mesh_ aligns
103+
closely with the inherent nature of most real-world business processes.
104+
Unlike traditional transactional systems that strive for immediate,
105+
irreversible consistency, the _Event Mesh_ allows for a more flexible and
106+
adaptive approach to data consistency. This results in better alignment with
107+
business requirements, as it supports scenarios where multiple services
108+
collaborate and synchronize their operations, making the whole state
109+
eventually consistent, without the constraint of strict, synchronous
110+
consistency.
111+
99112
=== _Event Mesh_ Flow
100113

101-
* Events are published as _Cloud Events_ to a _Knative_'s _Event Mesh_.
102-
* Triggers route events dynamically to the appropriate endpoints.
103-
* Services process events, update state, and emit new events for downstream
104-
consumers.
114+
The event-driven flow enables eventual consistent collaboration and state
115+
synchronization between services, fostering a resilient, scalable, and
116+
developer-friendly system architecture.
117+
118+
A usual flow may look like:
119+
120+
1. An end-user application sends a request, which forms a _Command_ event
121+
in the end transferred to the _Event Mesh_.
122+
2. The _Event Mesh_ (Broker) persists the event in Kafka (Kafka). After successful
123+
persistence _Event Mesh_ returns the success information, and at this point
124+
the operation could already be considered successful, from the end-user point
125+
of view.
126+
3. The _Event Mesh_ routes the event to the appropriate endpoint based on the
127+
event's metadata and configured rules.
128+
4. The receiving service receive the event and process it, updating their
129+
internal states and potentially emitting new events for downstream consumers.
130+
The potential events are transmitted to the _Event Mesh_.
131+
5. The dispatch loop continues until the event queue is empty and all the events
132+
are processed successfully. The failures are being automatically retried by
133+
the _Event Mesh_ using exponential backoff algorithm.
105134

106135
image::https://www.plantuml.com/plantuml/svg/XPBHhjGW48RlUOgnzzi7wCNcsDGOeySOZG_0qkcMB8NA33MDyTsbb6CNNUCT_FF_tv0PdeYbvp0PyOf7d10coUYrFBd0HbiKTDDsbbvEi5rvdH5cPzPK4yguq4FrPa7By8mqLl1302WtpSvkMlNUIjOBGklT3Nq5al8nshu531WjShZ9L4adyLE8mPaUFLJFMda7X7xH2kalUESZsXDysGs9aRKiHNylMLuauM7lsdjdrvRGTtPnMcbxBR2xYe-mHo23i_TFy4V7Uj1AidQsODyNihuDuIxw0QzIhK0hCKxb68xgwtbEkFrQF34xkbt8Wsgt9hbowjrtUphdtJJmALoCfX5msoozk6glhoFNvvY51hxEiG6cBcBF7OQqIOWSzAI9NpZbSg0sE73zpwuPUehlAeCDV7Q1yO4lZ_w_ldBafVdnK-lpyM4QU8jCeEtWG5vY2lgz98h-ANNyXjyJomfuLCxt99xGzc4olm00[width=100%]
107136

@@ -142,6 +171,10 @@ InvoiceService ..> InvoiceDB: Update Invoice records
142171
@enduml
143172
////
144173

174+
The diagram illustrates the example flow of events between the applications,
175+
the Knative _Event Mesh_, and the datastores which persist settled state of the
176+
system.
177+
145178
=== Supporting Legacy Systems
146179

147180
One of the strengths of an _Event Mesh_ architecture is its ability to integrate seamlessly with legacy systems, making them more resilient and adaptable. Legacy applications can be retrofitted to produce and consume events through lightweight adapters. For instance:

0 commit comments

Comments
 (0)