McDonald's Event-Driven Architecture - The Data Journey and How It Works
McDonald's Event-Driven Architecture - The Data Journey and How It Works
Save
187 4
Last week, in the first of a two-part post, we explained how we implemented event-
Get unlimited access Open in app
driven architecture in Global Technology. In this week’s post, we explore how
actually works and how the data flows through the system.
Here is a typical data flow of how events are reliably produced and consumed from
the platform:
4. The SDK performs schema validation to ensure the event is as per the schema.
5. If the validation checks out, SDK publishes the event to the primary topic.
9. SDK similarly performs schema validation to ensure the events are consuming
are as per the schema.
10. A successful consumption results in a committing of the offset back to MSK and
proceeds to consume the next event from the topic.
11. Events within a dead-letter topic are later rectified through an admin utility and
published back into the primary topic.
12. Events produced by our partners, or “Outer Events,” are published via an event
gateway.
Get unlimited access Open in app
Data governance
A key problem in consuming systems is data integrity. When there are assurances in
the integrity of the data, it saves a lot of time and complexity in the design of
downstream systems. MSK along with a schema registry allow us to enforce data
contracts between systems. A schema is defined as describing the expected data
fields and types along with optional versus required fields. In real-time, each
message is checked (via serialization libraries) against this schema for validity, or
else the message is routed to a dead-letter topic for rectification.
Using the schema registry this way validates data contracts across disparate systems
and helps ensures data integrity in our downstream analytics systems.
Cluster autoscaling
While MSK provided autoscaling of storage attached to the broker, a solution had to
be built for expanding the cluster. We created an autoscaler function that would get
triggered when a broker’s CPU utilization goes beyond a configurable threshold,
adding the broker to the MSK cluster, and then triggering another lambda function
to move partitions across the brokers.