Many organizations have long moved data in batches: every night, the day’s data is copied to the data warehouse. That works for daily reports. But some needs cannot wait until tomorrow morning, such as detecting suspicious transactions, tracking vehicles, or keeping stock accurate at all times. This is where data streaming and Apache Kafka come in.
What is data streaming?
Data streaming means each event is sent and processed as soon as it happens, instead of being collected and processed all at once. Examples of events: a new transaction, a click in an app, a vehicle’s GPS position, or an order status change.
What is Apache Kafka?
Kafka is an open-source platform for reliably streaming large volumes of events. Think of Kafka as a shared “log book”: sending systems write events to the log, and many receiving systems can read them, each at its own pace. Kafka is widely used because it is fault-tolerant, scalable, and keeps events for a set period so they can be re-read.
Kafka basics
- Event (message): one record of something that happened, usually with a key, value, and timestamp.
- Topic: a category or channel of events, such as
transactionsorgps-positions. - Partition: a split of a topic for parallel processing. Event order is guaranteed within a partition.
- Producer: an application that writes events to a topic.
- Consumer and consumer group: applications that read events. Consumers in the same group share partitions to process faster.
- Broker: a Kafka server that stores and serves events. Several brokers form a cluster.
- Retention: how long events are kept, for example 7 days, so lagging consumers can catch up.
A simple example flow
- A point-of-sale app (producer) sends each transaction to the
transactionstopic. - A fraud detection service (consumer 1) reads and checks transactions within seconds.
- A stock service (consumer 2) updates warehouse inventory.
- A data warehouse connector (consumer 3) stores transactions for analysis.
All three read the same data without interfering with each other, and the point-of-sale app does not need to know who is reading.
The ecosystem around Kafka
- Kafka Connect: ready-made connectors to move data to and from databases, files, or cloud services.
- Debezium: captures changes in a source database and sends them to Kafka. Read Change Data Capture with Debezium.
- Stream processing: Kafka Streams, Apache Flink, or Spark Structured Streaming for real-time aggregation and transformation.
- Analytical databases such as ClickHouse can read directly from Kafka for near real-time dashboards.
When do you really need Kafka?
A good fit if:
- Data must be processed in seconds, not hours.
- Event volume is large and continuous, for example thousands of events per second.
- One data source must be read by many different systems.
- You want to decouple sending and receiving systems.
Not needed yet if:
- Reports only need daily or hourly updates. Scheduled batch ETL is enough.
- Data volume is small and there is only one target system.
- The team lacks capacity to operate a cluster. Kafka needs monitoring and maintenance, unless you use a managed service.
Conclusion
Kafka is the backbone of real-time data architecture: events are sent once, read by many systems, and kept for replay. But not every organization needs it from day one. Start from the business need: how fast data must be available, and how many systems use it.
Learn data engineering with DNASTUDIO
We cover batch ETL, CDC, and streaming in our data engineering training programs, with hands-on practice.
