Insights · Data
Streaming data pipelines with Kafka and change data capture
By the Cystem X Engineering Team - Published - 5 min read
In this article
Streaming promises fresh data and loosely coupled systems. It also introduces ordering, replay and schema evolution as everyday concerns. This article explains when streaming is worth it and how Apache Kafka and change data capture can be combined into pipelines that stay reliable under real load.
Decide whether you need streaming
If a decision loses value when data is hours old, streaming may be justified: fraud signals, operational alerts, inventory changes. If a daily or hourly refresh meets the need, batch is simpler and cheaper to run.
Be honest about the requirement. Streaming for its own sake adds cost and operational burden.
Understand the Kafka model
Kafka stores events in partitioned, replicated logs called topics. Producers append, consumers read at their own pace and track their position. Because events are retained, consumers can be added later or replay history after a failure.
This decoupling is the main architectural benefit: producers do not need to know who consumes their data.
Treat every topic schema as a public interface.
Capture changes from databases
Change data capture reads a database transaction log and emits each insert, update and delete as an event. Tools such as Debezium do this without modifying the application and with little load on the source.
CDC turns operational databases into event sources, enabling search indexes, caches, analytics and other systems to stay synchronized.
Design topics and partitions
Partitioning determines parallelism and ordering: events with the same key go to the same partition and stay in order. Choose keys that match the ordering you need, such as customer or account identifier, and size partitions for expected throughput.
Set retention based on replay needs and storage, and use compaction for topics that represent the latest state per key.
Enforce schemas and contracts
Use a schema registry with compatibility rules so producers cannot publish changes that break consumers. Prefer formats such as Avro or Protobuf that support evolution.
Treat topic schemas as public interfaces, with owners, documentation and versioning.
Handle failure and delivery semantics
Understand at-least-once and exactly-once semantics and design consumers to be idempotent so reprocessing does not corrupt results. Use dead-letter topics for events that cannot be processed, with alerts and a process to repair and replay them.
Plan for backpressure and slow consumers so one problem does not cascade.
Monitor and operate
Track consumer lag, throughput, error rates, broker health and replication status. Lag is the headline metric: a growing lag means data is getting stale.
Automate topic and access management, secure the cluster with authentication, encryption and fine-grained authorization, and rehearse broker failure.
Key takeaways
- Use streaming only where freshness has real business value.
- Combine Kafka with CDC to stream database changes without touching applications.
- Choose partition keys to match ordering needs.
- Enforce schema compatibility with a registry.
- Design idempotent consumers, dead-letter handling and lag monitoring.
Sources and further reading
This article reflects general practice and publicly available guidance. Teams should consult primary sources, including the Apache Kafka documentation, the Debezium documentation and your schema registry vendor guidance, and adapt the guidance to their own environment, risk appetite and legal obligations.
Keep reading
More engineering guidance from the Cystem X team.
Data
Time-series and IoT telemetry platforms: ingestion, storage and analysis
Protocols, ingestion, storage, downsampling and security for sensor and machine data at scale.
Read articleData
Data governance in practice: ownership, lineage, quality and access
Ownership, catalog, lineage, quality checks and access control, enforced in the platform.
Read articleData
Zero-downtime database migrations: replication, validation and cutover
Assessment, conversion, replication, validation and a rehearsed cutover with a way back.
Read articleStreaming Data Pipelines
Move data in real time with confidence.
We design and operate streaming platforms with schema discipline and visibility from day one.
Explore Streaming Data Pipelines