<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Puja Nikam</title>
    <description>The latest articles on DEV Community by Puja Nikam (@the_puja_nikam).</description>
    <link>https://dev.to/the_puja_nikam</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4234110%2F22b9353d-072b-4e2c-bfd6-6bf670ad6458.png</url>
      <title>DEV Community: Puja Nikam</title>
      <link>https://dev.to/the_puja_nikam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/the_puja_nikam"/>
    <language>en</language>
    <item>
      <title>Designing Evolvable Kafka Event Architectures: Schema Evolution Without Breaking Consumers</title>
      <dc:creator>Puja Nikam</dc:creator>
      <pubDate>Sun, 08 Nov 2026 21:15:28 +0000</pubDate>
      <link>https://dev.to/the_puja_nikam/designing-evolvable-kafka-event-architectures-schema-evolution-without-breaking-consumers-4a20</link>
      <guid>https://dev.to/the_puja_nikam/designing-evolvable-kafka-event-architectures-schema-evolution-without-breaking-consumers-4a20</guid>
      <description>&lt;p&gt;&lt;strong&gt;Project Context:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is &lt;strong&gt;Issue #13&lt;/strong&gt; of my ongoing implementation series for a &lt;strong&gt;Kafka-based distributed telemetry ingestion platform.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The complete implementation and future iterations can be tracked here: &lt;a href="https://github.com/Pujagithub2006/Streamly" rel="noopener noreferrer"&gt;Repository.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This issue focuses on &lt;strong&gt;schema evolution, version-aware event processing, and designing stable event contracts for changing telemetry requirements.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While building this &lt;strong&gt;Kafka-based distributed telemetry ingestion platform&lt;/strong&gt;, I reached a point where the problem was no longer about moving data from one place to another.&lt;/p&gt;

&lt;p&gt;The pipeline already had the fundamental flow:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Sensor Producers → Kafka Topics → Consumers → Processing Layer → Persistence Layer → Database&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The challenge was:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;How do we evolve telemetry events when the data model itself changes over time?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Imagine a sensor device today sends:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Temperature&lt;/li&gt;
&lt;li&gt;Humidity&lt;/li&gt;
&lt;li&gt;Timestamp&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tomorrow, a newer generation of the device sends:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Temperature&lt;/li&gt;
&lt;li&gt;Humidity&lt;/li&gt;
&lt;li&gt;Timestamp&lt;/li&gt;
&lt;li&gt;Battery Level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Current file structure:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fktjsd8qpckwqt5vchri6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fktjsd8qpckwqt5vchri6.png" alt=" " width="800" height="491"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Figure 1: Current telemetry package structure showing the organization of domain models, versioned event contracts, processing services, Kafka consumers, and persistence components.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The easiest approach is to keep modifying one event class and keep adding fields. But that creates a growing contract:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;telemetry/domain/TelemetryEvent.java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbznbegkmte3d2mshorlo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbznbegkmte3d2mshorlo.png" alt=" " width="470" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Initial telemetry event model before introducing version-specific representations. The model started accumulating fields that belonged only to certain device versions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Over time, the original event becomes tightly coupled to every future requirement.&lt;/p&gt;

&lt;p&gt;Older versions start carrying fields they never understood, and every new change risks affecting existing consumers.&lt;/p&gt;

&lt;p&gt;The question became:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;How do we allow event versions to evolve independently while keeping the processing pipeline stable?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flkqx78pywt0fv1mcq8ji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flkqx78pywt0fv1mcq8ji.png" alt=" " width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Figure 2: The initial single-event approach where new requirements continuously expand the telemetry model, increasing coupling between event versions and consumers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first design decision was to separate telemetry versions.&lt;/p&gt;

&lt;p&gt;Instead of one expanding model, I introduced:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TelemetryEventV1 -&amp;gt; Temperature + Humidity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;telemetry/domain/event/TelemetryEventV1.java:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F38keqnwevedh094t3wcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F38keqnwevedh094t3wcd.png" alt=" " width="800" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TelemetryEventV1 implementation representing the first telemetry schema version with only the common sensor fields defined by the VersionedTelemetryEvent contract.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;TelemetryEventV2 -&amp;gt; Temperature + Humidity + Battery Level&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;telemetry/domain/event/TelemetryEventV2.java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F39eq63wrofu1huqecv6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F39eq63wrofu1huqecv6z.png" alt=" " width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TelemetryEventV2 implementation extending the telemetry schema with battery support through BatteryAwareTelemetryEvent while maintaining the common VersionedTelemetryEvent contract.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now the versions could evolve independently. But this introduced another question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Who decides which version of the event should be created?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer was a dedicated version mapping layer.&lt;/p&gt;

&lt;p&gt;The flow became:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0kvu2rmsax07i8ih9yrt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0kvu2rmsax07i8ih9yrt.png" alt=" " width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Figure 3: Version-specific telemetry models allowing each event version to evolve independently while keeping version selection centralized through TelemetryEventVersionMapper.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The mapper correctly identified the version and created the corresponding event object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;telemetry/service/TelemetryEventVersionMapper.java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9vs8ikuxsir2d4afrxnv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9vs8ikuxsir2d4afrxnv.png" alt=" " width="800" height="677"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TelemetryEventVersionMapper centralizing version selection and transformation logic to convert incoming telemetry events into their corresponding version-specific implementations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then I encountered a Java type system problem.&lt;/p&gt;

&lt;p&gt;Initially, the mapper returned:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Object&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This was because both versions were objects. The mapping worked. But the consumer received only:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Object event;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At that point, Java only knew:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"This is an Object."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It did not know whether it was:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TelemetryEventV1&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;TelemetryEventV2&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The version information was lost at the contract level and the consumer could not safely access version-specific behavior.&lt;/p&gt;

&lt;p&gt;This led to introducing a common contract:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VersionedTelemetryEvent&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now both event versions implemented the same interface. The flow evolved into:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Falj9dy94fftm4ri8lplx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Falj9dy94fftm4ri8lplx.png" alt=" " width="799" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Figure 4: Common event contract introduced through VersionedTelemetryEvent, allowing multiple telemetry versions to share a stable abstraction while preserving their version-specific fields.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The consumer no longer cared about the exact implementation. It only depended on the contract. This was the first application of the *&lt;em&gt;Dependency Inversion Principle: *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;High-level processing logic depended on an abstraction rather than concrete event classes.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;telemetry/domain/event/VersionedTelemetryEvent.java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb1s0yv5osxdltm84o6i7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb1s0yv5osxdltm84o6i7.png" alt=" " width="799" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;VersionedTelemetryEvent defining the stable contract shared across all telemetry event versions while keeping version-specific capabilities outside the core interface.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But another design question appeared. If the processor receives:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VersionedTelemetryEvent event;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;what happens when V2 has:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getBatteryLevel()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;but V1 does not?&lt;/p&gt;

&lt;p&gt;Should battery become part of the common interface? Something like:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;interface VersionedTelemetryEvent {&lt;/strong&gt; &lt;br&gt;
    &lt;strong&gt;getTemperature();&lt;/strong&gt; &lt;br&gt;
    &lt;strong&gt;getHumidity();&lt;/strong&gt; &lt;br&gt;
    &lt;strong&gt;getBatteryLevel();&lt;/strong&gt; &lt;br&gt;
&lt;strong&gt;}&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That would solve V2, but it would force V1 to support functionality it does not have. The contract would become polluted.&lt;/p&gt;

&lt;p&gt;The solution was &lt;strong&gt;capability-based design.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of making every telemetry event support every possible feature:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VersionedTelemetryEvent -&amp;gt; BatteryAwareTelemetryEvent -&amp;gt;&lt;/strong&gt; &lt;strong&gt;LocationAwareTelemetryEvent -&amp;gt; FirmwareAwareTelemetryEvent&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Only events that support a capability implement it. So:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TelemetryEventV1 -&amp;gt; VersionedTelemetryEvent TelemetryEventV2 -&amp;gt;&lt;/strong&gt; &lt;strong&gt;VersionedTelemetryEvent + BatteryAwareTelemetryEvent&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;telemetry/domain/event/capability/BatteryAwareTelemetryEvent.java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F26xjpkmlqxdjhxvwbkcu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F26xjpkmlqxdjhxvwbkcu.png" alt=" " width="800" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;BatteryAwareTelemetryEvent capability interface isolating battery-specific behavior so only telemetry versions supporting battery data implement this additional contract.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;telemetry/domain/event/capability/LocationAwareTelemetryEvent.java:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fum0t402n0c3qeg3fi5g2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fum0t402n0c3qeg3fi5g2.png" alt=" " width="667" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;LocationAwareTelemetryEvent capability interface designed to support future location-enabled telemetry versions without modifying the core event contract.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now the processor can handle optional capabilities safely:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;telemetry/service/TelemetryEventProcessor.java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzvufhynes2h4z99igo0d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzvufhynes2h4z99igo0d.png" alt=" " width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TelemetryEventProcessor consuming the common VersionedTelemetryEvent contract, transforming events into persistence records, and handling optional capabilities through capability-based interfaces.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This followed the** Interface Segregation Principle:**&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Classes should not be forced to depend on methods they do not use.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next responsibility boundary was processing.&lt;/p&gt;

&lt;p&gt;The event object should not directly become a database entity.&lt;/p&gt;

&lt;p&gt;So the final flow became:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F001mbkjc7ez4mjpqom4c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F001mbkjc7ez4mjpqom4c.png" alt=" " width="792" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Figure 5: Final telemetry processing flow separating event version handling, business transformation, and persistence responsibilities across independent layers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The processor became responsible for transformation. The persistence layer became responsible only for persistence.&lt;/p&gt;

&lt;p&gt;This followed the &lt;strong&gt;Single Responsibility Principle:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Mapper handles version selection.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;- Processor handles transformation.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;- Persistence handles storage.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each component has one clear reason to change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Consumer Service - TelemetryConsumerService.java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyh0eab4zqi6f6u7jebgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyh0eab4zqi6f6u7jebgv.png" alt=" " width="800" height="657"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TelemetryConsumerService orchestrating the version-aware Kafka consumption flow by mapping incoming events, processing versioned telemetry contracts, and delegating persistence responsibilities.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The final architecture allowed:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- New telemetry versions without modifying existing ones.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;- Optional capabilities without bloating the base interface.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;- Cleaner separation between ingestion, processing, and storage.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The important realization was:&lt;br&gt;
&lt;strong&gt;Schema evolution is not solved by adding a version number.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;The real challenge is designing the boundaries correctly:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- What belongs to every event?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;- What belongs to a specific version?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;- What should become a capability?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;- Which layer should know about version details?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One more architectural gap became clear during this process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The consumer side is now version-aware:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Kafka Event -&amp;gt; Version Mapper -&amp;gt; Versioned Processing&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But the producer side is still using the generic event contract.&lt;/p&gt;

&lt;p&gt;The complete evolution will eventually become:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;_Producer -&amp;gt; Versioned Event DTO -&amp;gt; Kafka -&amp;gt; Versioned Consumer -&amp;gt;&lt;/strong&gt; &lt;strong&gt;Processing -&amp;gt; Persistence_&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That introduces the next design area:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Polymorphic Kafka serialization&lt;/li&gt;
&lt;li&gt;Producer-side versioned DTOs&lt;/li&gt;
&lt;li&gt;Event envelope design&lt;/li&gt;
&lt;li&gt;Schema compatibility strategies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most valuable part of this implementation was not creating multiple event classes.&lt;/p&gt;

&lt;p&gt;It was learning that good architecture often comes from repeatedly asking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;"Does this responsibility really belong here?"&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every uncomfortable question exposed a better boundary.&lt;/p&gt;

&lt;p&gt;I would love to hear your thoughts and perspectives on designing evolvable event-driven systems. How do you approach schema evolution in Kafka-based architectures? What patterns or trade-offs have worked well in your production systems?&lt;/p&gt;

&lt;p&gt;Open to discussions, feedback, and different architectural viewpoints.&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

</description>
      <category>kafka</category>
      <category>eventdriven</category>
      <category>java</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
