Overview
Choose a naming convention early. Kafka cannot rename a topic (kafka-topics.sh --alter changes partitions and replica assignment), so a new name means creating a new topic and migrating producers and consumers. Topic names may use letters, digits, '.', '_' and '-', up to 249 characters. Use either '.' or '_' as a separator, not both: because of limitations in metric names, two topics whose names differ only by '.' versus '_' (such as a.b and a_b) can collide on one metric name, and kafka-topics.sh --create prints a warning for any name containing either character. ACLs can match topics by prefix (--resource-pattern-type prefixed), so a name prefix is one way to organise access per team. Compacted topics keep at least the latest value for each key, which suits lookup data. Naming patterns such as {domain}.{entity}.{event-type}, one topic per event type, and the use of a schema registry are team conventions, not Apache Kafka features, and Schema Registry is not part of Apache Kafka.
Production tip
Check yourself
Two topics are named a.b and a_b. What can happen?
Sources
- Topic.java (4.2 source) (opens in a new tab)
- TopicCommand.java (4.2 source) (opens in a new tab)
- Basic Kafka operations (4.2 documentation) (opens in a new tab)
- Authorization and ACLs (4.2 documentation) (opens in a new tab)
- Design (4.2 documentation) (opens in a new tab)
Checked against Kafka 4.2 documentation on Oct 2026. Draft: not yet reviewed by a Kafka specialist. Releases move on, so confirm against the current documentation before you act on a number.