📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Apache Kafka Topics and Partitions

Topics and Partitions

5 min read Quiz at the end
Topics organise messages; partitions enable parallelism and ordering guarantees per key.

Topics and Partitions

# Create topic
kafka-topics.sh --create   --bootstrap-server localhost:9092   --topic orders   --partitions 3   --replication-factor 1

# List topics
kafka-topics.sh --list --bootstrap-server localhost:9092

# Describe topic
kafka-topics.sh --describe --topic orders   --bootstrap-server localhost:9092

# Delete topic
kafka-topics.sh --delete --topic orders   --bootstrap-server localhost:9092

# Partitions allow parallel consumption
# Messages with same key go to same partition (ordering guaranteed)
# More partitions = more parallelism = more consumers
# Rule: partitions >= consumers in group
Topic Quiz · 1 questions

Test your understanding before moving on

1. What determines which partition a Kafka message goes to?
💡 If a key is set, Kafka hashes it to a consistent partition; without a key, round-robin is used.