What is Apache Kafka? Events, Topics, Brokers and Why Companies Use It

Apache Kafka 14 min min read Updated: Nov 17, 2026 Beginner
What is Apache Kafka? Events, Topics, Brokers and Why Companies Use It
Beginner Topic 1 of 4

The Problem Kafka Solves

Imagine an online shop. When a customer places an order, many systems need to know: payments, stock, shipping, email, analytics and fraud checks. If the order service calls each of them directly, it becomes slow and fragile: if the email service is down, the order may fail.

With Apache Kafka the order service writes one event ("order 1001 was placed") to Kafka and moves on. Every other system reads the event when it is ready. The services are decoupled, and the events are stored safely so they can be read again.

text Without Kafka: Order --> Payment --> Stock --> Email (many direct connections, tight coupling) --> Analytics With Kafka: Order --> [ Kafka: topic "orders" ] --> Payment --> Stock --> Email --> Analytics (each reads at its own speed)

What is Apache Kafka?

Apache Kafka is an open-source distributed event streaming platform. It lets you publish streams of events, store them durably for as long as you want, and process or read them in real time or later. Kafka was created at LinkedIn and is now used by a large share of big companies.

The Main Building Blocks

TermMeaningSimple example
Event (record, message)A fact that happened: key, value, timestamp and optional headerskey=order-1001, value={"amount":250}
TopicA named stream of events, like a table or folder for one kind of eventorders, payments, page-views
PartitionA topic is split into partitions. Each is an ordered, append-only logorders-0, orders-1, orders-2
OffsetThe position number of a record inside a partition0, 1, 2, 3 ...
BrokerA Kafka server that stores partitions and serves clientsbroker-1, broker-2, broker-3
ClusterA group of brokers working together3 or more brokers in production
ProducerAn application that writes events to topicsOrder service
ConsumerAn application that reads events from topicsEmail service
Consumer groupA set of consumers sharing the work of one topic3 instances of the Email service
ReplicationCopies of each partition on other brokers for safetyreplication factor 3

A Topic with Partitions

text Topic "orders" with 3 partitions Partition 0: [0][1][2][3][4][5] -> new events are appended here Partition 1: [0][1][2][3] Partition 2: [0][1][2][3][4] Each box is a record. The number is its offset. Records are never changed, only appended. Order is guaranteed INSIDE one partition, not across partitions.

Kafka vs a Traditional Message Queue

Traditional queue (for example RabbitMQ)Apache Kafka
Message after readingUsually removed after it is consumedKept (until retention expires). Many consumers can read the same data
Replay old dataHardEasy: reset the offset
ThroughputGoodVery high (millions of events per second on a cluster)
OrderingPer queuePer partition
Typical useTask queues, request/response, routingEvent streaming, data pipelines, event sourcing, analytics
Not either-or: Many companies use both. A queue is great for background jobs. Kafka is great when many systems need the same stream of facts, or when you need replay and very high volume.

Common Use Cases

  • Event-driven microservices: services talk through events
  • Real-time analytics: dashboards, fraud detection, recommendations
  • Data pipelines: move data from databases to data lakes and warehouses (with Kafka Connect and CDC)
  • Log and metrics collection: collect logs from thousands of servers
  • Activity tracking: clicks, page views, IoT sensor data
  • Event sourcing: store every change as an event and rebuild state

The Kafka Ecosystem

PartPurposeWhere you learn it
Kafka brokersStore and serve eventsSections 1 to 5
Producer and Consumer APIsWrite and read events from your codeSections 2 and 3
Kafka ConnectMove data in and out of Kafka without writing codeSection 8
Kafka StreamsProcess events with a Java library (filters, joins, windows)Section 9
Schema RegistryManage and check event formats (Avro, Protobuf, JSON Schema)Section 10
MirrorMaker 2Copy topics between clusters (disaster recovery)Section 7

Version Notes

Modern Kafka (4.0 and later) runs without ZooKeeper. The brokers manage cluster metadata themselves using KRaft. This course teaches KRaft-based Kafka, and points out older behaviour only where you may meet it in existing clusters.

How to study: Install Kafka on your computer in the next lesson and run every command yourself. Seeing messages flow from a producer to a consumer is the fastest way to understand Kafka.

Conclusion

Kafka is a distributed, durable log of events. Producers append events to topics, topics are split into ordered partitions stored on brokers, and consumers read at their own pace. This decouples systems and allows replay and very high throughput.

Quick Summary: event = fact; topic = stream; partition = ordered log; offset = position; consumer groups share work.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators