Skip to content
BENIBIX Learn

Kafka Topic

Also known as Topic, Event Topic

A named stream of one kind of event, such as orders.

Think of it like

It is like a named shelf in a shop. All the shoes go on the shoe shelf.

Example

A shop has three topics: orders, payments and page-views. The email app reads just orders.

Why it matters

Topics are how events are sorted. A good topic name tells every team where to look.

Definition

A Kafka topic is a named stream of events of one kind, such as orders or clicks. Producers write events to a topic by name. Consumers read from a topic by name. Each topic is split into one or more partitions. It has its own settings, such as how long its events are kept.

Example code

console
$ kafka-topics.sh --create --topic orders \
    --partitions 3 --bootstrap-server localhost:9092
Created topic orders.
Make an orders topic with three partitions.

Common mistake

Putting every kind of event into one topic. Readers then have to sift through events they do not want.

Key takeaways

  1. 1
    Named stream. One kind of event per topic.
  2. 2
    Split into partitions. For speed and scale.
  3. 3
    Own settings. Like how long events are kept.