What is the best practice for naming kafka topics?

apache-kafka, naming-conventions

Solution

https://cnr.sh/essays/how-paint-bike-shed-kafka-topic-naming-conventions helped us answering that same question.

As a summary this article suggest to follow similar best practices to naming databases and tables, and it provides these additional points of advice:

- Avoid topic names based on things that change

- Avoid topic names based on information that would be stored in other places

- Avoid topic names based on their planned consumers/producers. This is essentially a special case of the first advice :D.

- Decide casing early on, and consider enforcing it or at least check/monitor it. This way you catch offenders early on.

Problem

We are new to kafka and we have a few teams working on a few applications that publish/subscribe events to/from each other. Since the kafka topic names are going to be shared across teams, is there any best practice for naming? Basically we don't want to see team A naming a topic `companyname-appname-events` while team B naming another topic `productname_functionB` in totally different styles. Any suggestions are appreciated ! Note this probably sounds more like the following asked question: What should be naming convention of topic and partition of Kafka? However, the author there was asking something more specific.

Original source