Designing Topic Naming Conventions in Kafka
How to choose clear, consistent and future-proof names for Kafka topics, what the platform allows, which parts a good name should carry, and how to enforce the rules so a cluster stays understandable as it grows from ten topics to ten thousand.
Picture a huge library where every book is stored under a title its author picked on a whim. One shelf holds “Stuff”, another “stuff_new”, a third “Stuff FINAL v2”, and a fourth “misc-do-not-touch”. Finding a book takes hours. Nobody knows who owns which shelf, which books are safe to borrow, or which ones are old copies. Now picture a library where every shelf label follows one pattern: subject, section, and edition. Anyone can walk in and find what they need in seconds.
A Kafka cluster is that library, and a topic name is the shelf label. Names look like a tiny detail, yet they decide how easy it is to find data, protect it, monitor it, and change it later. Worse, a topic name cannot be changed once created. In this guide you will learn what a naming convention is, what Kafka itself allows, which pieces a good name should hold, how to handle versions, environments, security and internal topics, and how to enforce the rules with automation so that they last.
1What a Topic Naming Convention Is
A naming convention is a written agreement about how every topic in your organization is named.
Start with the basic words. Apache Kafka is a system that stores streams of messages and lets many programs read and write them. A message, also called a record, is one small piece of data, such as “order 1001 was paid”. A topic is a named place where messages of one kind are stored, like a labeled folder. Programs that write messages are producers, and programs that read them are consumers. Servers that hold the data are brokers.
A naming convention is a set of rules that says how a topic name is built. For example: “the name has four parts separated by dots, in lowercase: environment, domain, entity, and version”. If every team follows the rule, a name such as prod.sales.order-paid.v1 tells you at a glance where the data comes from, what it is, and which edition you are looking at.
The convention is not a Kafka feature. Kafka only checks a few basic character rules. The convention is a human and process agreement, ideally backed by tools that check it automatically. Think of it as the grammar of your cluster.
Think of postal addresses. Country, city, street and house number always come in the same order, so any postman can deliver a letter he has never seen before. A topic name is an address for data. If every team writes addresses in its own order, letters get lost.
Treat your naming convention as a small product with owners, documentation, examples and a way to ask for exceptions. A rule that nobody can find is a rule nobody follows.
2Why Topic Names Matter So Much
A topic name is used everywhere: in code, in security rules, in dashboards, in alerts and in conversations between people.
Three facts make topic names special. First, a topic cannot be renamed. To change a name you must create a new topic, copy the data, and move every producer and consumer. Second, the name is copied into many other places: application configuration, access control rules, monitoring queries, schema subjects, connector settings and documents. Third, names are read by humans in an emergency at three in the morning, when clarity matters most.
What good names give you
Find data fast
Engineers can list topics for one domain or one team and understand them without asking around.
Know who to call
A name or a linked catalog entry shows which team owns the topic and who to page when it breaks.
Write simple access rules
Rules that match a prefix let you grant a team access to all its topics with a single line.
Automate
Scripts and dashboards can group topics by pattern, set default settings, and alert the right people.
Change safely
Versions in names allow breaking changes without breaking every reader at once.
Spot waste
Clear names show forgotten test topics and duplicates that consume disk and money.
Think of naming the pipes in a big building. Pipes labeled “cold water, floor 3, kitchen” can be fixed by any plumber. Pipes labeled “pipe 1”, “pipe 2” need the original builder, who may have left the company years ago.
3The Anatomy of a Topic Name
A good name is built from a few small parts placed in a fixed order, like beads on a string.
Most conventions choose from the same set of parts. Not every organization needs all of them. The art is picking the smallest set that answers the questions people really ask.
flowchart LR A["Environment"] --> B["Domain or business area"] B --> C["Subdomain or service"] C --> D["Data type"] D --> E["Entity name"] E --> F["Version"]
Read the figure from left to right. The name starts broad and becomes more specific, just like an address that moves from country to house number. Each part answers one question.
| Part | Question it answers | Example |
|---|---|---|
| Environment | Which stage is this: production, staging or test? | prod |
| Domain | Which business area owns the data? | sales |
| Subdomain or service | Which part of the area or which application? | checkout |
| Data type | Is it an event, a command, a snapshot or an internal topic? | event |
| Entity | What thing is the data about? | order-paid |
| Version | Which edition of the data shape? | v1 |
Putting these together might give prod.sales.checkout.event.order-paid.v1. That is long but complete. Many teams shorten it by dropping parts that are already known. A cluster that serves only production does not need an environment part. A small company with one domain does not need a domain part.
Every extra part makes names longer and harder to read aloud. Add a part only when it is needed to tell topics apart or to write a useful security or monitoring rule.
4What Kafka Itself Allows
Before designing rules, know the limits of the platform. Your convention must live inside them.
| Rule | Detail |
|---|---|
| Allowed characters | Letters, digits, dot, underscore and hyphen |
| Maximum length | 249 characters |
| Reserved names | A single dot and a double dot are not allowed as names |
| Case | Names are case sensitive, so Orders and orders are different topics |
| Spaces and special characters | Not allowed |
| Internal topics | Kafka uses names starting with a double underscore for its own topics |
The dot and underscore collision
Kafka turns topic names into metric names for monitoring. In that process, a dot and an underscore can look the same. A topic called orders.paid and another called orders_paid may produce clashing metric names, and Kafka refuses to create a topic whose name collides this way with an existing one. This is a technical reason to pick one separator style and stay with it, rather than mixing dots and underscores in the same cluster.
Case sensitivity
Because names are case sensitive, “Orders” and “orders” can exist together, which invites confusion. Choose lowercase for everything. Lowercase names are easier to type, easier to match with patterns, and safe on systems where file names ignore case, since topics are stored as folders on disk.
Think of speaking on a phone line with a bad connection. Names that differ only by a capital letter or by a dot versus a dash are like two people called Jon and John. Somebody will call the wrong one.
The rules above are long-standing. Confirm them against the documentation of the Kafka version you run, especially for managed cloud services that may set stricter limits of their own.
5Choosing Separators, Case and Style
Small style choices, made once, prevent thousands of small arguments later.
A separator is the character that splits the parts of a name. The three legal choices are the dot, the hyphen and the underscore. Each has strengths.
| Separator | Strengths | Weaknesses |
|---|---|---|
| Dot | Reads like a hierarchy; common in the Kafka community; easy to split into parts | Collides with underscore in metrics if both are used; some tools treat dots as special |
| Hyphen | Very readable inside words such as order-paid; no metric collision with dots | Can look like a minus sign in some tools; less obviously hierarchical |
| Underscore | Familiar to database people; works well as a word joiner | Collides with dots in metrics; harder to see in underlined links |
A popular combination
Many teams use dots between levels and hyphens inside a level. So sales.checkout.order-paid.v1 has three levels split by dots and a compound word joined by a hyphen. This gives you a clear hierarchy and readable words, and it avoids mixing dots with underscores.
Other style rules worth writing down
All lowercase
No capitals anywhere. It removes a whole class of typing mistakes.
Full words, few abbreviations
Use “customer”, not “cst”. If you allow abbreviations, keep an approved list.
Singular or plural, pick one
Say “order-paid” or “orders-paid”, but never both. Singular is common because each message is one fact.
Past tense for events
Events describe facts that already happened, so “order-placed” is better than “order-place”.
One human language
Keep all names in one language, usually English, so search works.
No secrets, no people
Never put personal data, passwords or individual names into a topic name.
Names such as “mysql-orders-topic” tie the name to a tool that may be replaced next year. Name the business meaning, not the machinery. The word “topic” inside a topic name adds nothing.
6Common Convention Styles Compared
There is no single correct convention. Here are the main families, with their good and bad sides.
| Style | Example | Good for | Watch out for |
|---|---|---|---|
| Domain first | sales.checkout.order-paid.v1 | Organizations with clear business areas and ownership | Domains that change when the company reorganizes |
| Team first | team-payments.invoice-created | Small companies where teams own everything | Team names change; data outlives teams |
| Data type first | event.order.paid | Platforms that treat events, commands and state differently | Hard to grant access by business area |
| Environment first | prod.sales.order-paid | Shared clusters holding several stages | Long names; better to use separate clusters |
| Flat names | order-paid | Very small systems and prototypes | Collisions and confusion as the system grows |
| Source based | mysql.shop.orders | Raw change data capture topics | Leaks technical details to consumers |
Which family should you choose?
For most growing organizations, domain first works best. Business domains such as sales, billing, shipping and identity are more stable than team names or technologies. Data outlives the team that first wrote it. A domain-based name still makes sense after three reorganizations.
Think of a supermarket. Goods are arranged by kind: dairy, bakery, drinks. They are not arranged by which delivery driver brought them. Drivers change every month; the need for milk stays. Domain-first names are the supermarket layout.
For every part of a name ask: “Will this still be true in five years?” Environment names, team names and tool names usually fail this test. Business domain names usually pass.
7Naming by Business Domain
Domain-based naming ties each topic to a part of the business, so ownership and meaning are obvious.
A domain is an area of the business with its own language, rules and people, such as payments, inventory or customer identity. The idea comes from a design approach that splits a large system into domains, each owned by one team. The team is responsible for the data it publishes, just as a department is responsible for its reports.
Choosing domain names
List the business areas
Use words the business uses in meetings, such as sales, billing, logistics and support, not names of software products.
Give each area one owner
Every domain has an owning team that approves new topics and answers questions.
Keep the list short
A dozen well-chosen domains beat sixty overlapping ones. Overlap causes debates about where a topic belongs.
Publish the list
Store the approved domains where everyone can read them, and add new ones through a light review.
Subdomains and services
Inside a domain, a second level often names a subdomain or a service, for example sales.checkout and sales.catalog. Be careful with service names: services are split and merged over time. Where possible, name the subdomain by business function, not by the current application that happens to implement it.
A hospital labels its wings by function: emergency, maternity, radiology. It does not label them by the contractor who built each wing. When a new contractor extends the building, the labels stay valid.
A domain named “common”, “shared” or “misc” quickly becomes a dumping ground. If a topic does not fit any domain, that is a signal to discuss ownership, not to invent a vague home.
8Naming by Kind of Data: Events, Commands and State
Not all messages are alike. A good name tells readers what kind of message a topic holds.
Three kinds of data appear again and again in Kafka systems, and mixing them causes confusion.
Something happened
A fact in the past, such as “order paid”. Events are never denied later; a correction is a new event. Names use past tense.
Please do this
A request for action, such as “send this email”. A command may be refused. Names use an action phrase.
This is how things are now
The latest version of a thing, such as a customer profile. Often kept with compaction so only the newest value per key remains.
Ways to show the kind in the name
| Approach | Example | Comment |
|---|---|---|
| Type as a name part | sales.event.order-paid.v1 | Explicit and easy to filter, but longer |
| Type by word form | sales.order-paid.v1 | Past tense signals an event; short, but subtle |
| Type as a suffix | sales.customer.state.v1 | Groups all versions of one entity together |
| Separate clusters or prefixes for commands | cmd.sales.send-invoice | Makes access rules and retention settings simple |
The reason to show the kind is that each kind is treated differently. Events are usually kept for a time period, commands are short-lived, and state is often compacted. Setting the right default for each kind is easier when the name reveals the kind.
Think of a mailbox at home. Newspapers report what happened, letters ask you to do something, and your address label tells where you live now. You would not want them all mixed in one pile without any marking.
Prefer “order-shipped” over “ship-order” for event topics. A fact-style name stops people from treating the topic as a to-do list, which would tie producers to what consumers do.
9Public and Private Topics
Some topics are promises to the whole company. Others are private details of one application. Names should show which is which.
A public topic, sometimes called a shared or contract topic, is meant to be read by other teams. Its format is a promise: the owner will keep it stable, document it and version it carefully. A private topic is used only inside one application or team. Its format can change freely because no outsider depends on it.
flowchart LR A["Service A private topics"] --> B["Service A logic"] B --> C["Public topic: sales.order-paid.v1"] C --> D["Team B consumer"] C --> E["Team C consumer"] F["Team B private topics"] --> D
The figure shows that service A keeps its own working topics private, and publishes only one clean public topic that teams B and C read. If service A changes its internal design, only its private topics change, and the public promise stays.
Marking visibility in names
| Method | Example | Effect |
|---|---|---|
| Prefix for public | public.sales.order-paid.v1 | Clear, and access rules can allow all readers |
| Prefix for private | private.checkout.cart-work.v1 | Rules can deny outside readers by default |
| Team or service segment for private | checkout-svc.internal.cart-work | Owner is obvious; only that team gets access |
When another team reads a private topic, it becomes an unplanned contract. The owner cannot change it without breaking a stranger. Visibility marks plus access rules help stop this early.
10Internal, Retry and Dead Letter Topics
Besides business topics, many helper topics appear. They also need clear names.
Created by Kafka
Kafka creates topics for its own work, for example one that stores consumer progress. Their names start with a double underscore. Never create your own topics with that style, and never delete these.
Created by Kafka Streams
Stream processing applications create repartition and changelog topics. Their names are built from the application id, so the application id is part of your naming design.
Created by Connect
Kafka Connect stores its configuration, offsets and status in topics whose names you choose. Give them a clear, cluster-specific name.
Second chances
Failed messages may be sent to a retry topic to be processed again after a delay. The name should show the original topic and the retry stage.
Messages that cannot be handled
Messages that keep failing go to a dead letter topic for people to inspect. The name should point to the source topic and the consumer that failed.
Schema storage
A schema registry keeps its data in a topic, often with an underscore-prefixed default name. Treat it as infrastructure.
A pattern for retry and dead letter names
A common approach is to add a suffix to the source topic name and to include the consumer group, because two different consumers of one topic may fail on different messages. For example, a topic sales.order-paid.v1 read by the group billing-invoicer could have sales.order-paid.v1.billing-invoicer.retry-1 and sales.order-paid.v1.billing-invoicer.dlt. The suffix approach keeps related topics sorted together in listings and lets access rules treat them as a family.
Think of a post office. Undeliverable letters go to a special room labeled with the route they came from, so staff can work out what went wrong. A room labeled just “problems” would be useless after the first week.
Retry and dead letter topics fill up silently. Name them so that alerts can find them by pattern, and assign the consuming team as owner.
11Versioning in Topic Names
Data shapes change. A version marker lets you introduce a breaking change without breaking every reader on the same day.
A version in a name, such as v1 or v2, marks a major edition of the message format. It is not needed for every small change. Kafka teams usually keep a schema registry that checks compatibility of changes. Adding an optional field, for example, can happen without a new topic. But some changes are breaking: removing a field, changing a meaning, or changing a type in a way old readers cannot understand. For breaking changes, a new topic name gives everyone a clean path.
flowchart TD A["Producer writes v1 topic"] --> B["Breaking change needed"] B --> C["Create v2 topic"] C --> D["Producer writes both v1 and v2"] D --> E["Consumers migrate one by one"] E --> F["All consumers on v2"] F --> G["Stop writing v1 and retire it after retention"]
The figure shows the dual-write period. The producer writes the same fact in both formats for a while. Each consuming team switches when ready. When nobody reads v1 any more, the producer stops writing it, and the old topic expires under its retention rules and is then deleted.
Where to put the version
| Placement | Example | Comment |
|---|---|---|
| Last part | sales.order-paid.v2 | Most common; all versions of an entity sort together |
| Middle | sales.v2.order-paid | Groups all v2 topics of a domain; less common |
| Not in the name | sales.order-paid | Simple; depends on schema compatibility rules to protect readers |
Use major versions only
A name should carry only the major version, like v1 and v2, never v1.2.3. Minor changes should be compatible and therefore need no new topic. If names carry minor versions, every small change forces every consumer to switch, which defeats the purpose.
Think of a phone charger port. Small improvements inside the phone do not change the port. When the port shape changes completely, a new generation of cables is needed, and the old and new cables live together for a while. The name of the port generation is the version.
Every extra version is a full copy of the data. Set an end date for old versions and follow it, or you pay twice for years.
12Environments and Multiple Clusters
Should the environment, such as production or test, be part of the topic name? It depends on how you run your clusters.
An environment is a stage of software life: development, testing, staging, production. A cluster is a group of brokers working together. There are two main designs.
| Design | Environment in name? | Advantages | Drawbacks |
|---|---|---|---|
| Separate cluster per environment | No | Same topic names everywhere; code moves between stages unchanged; strong isolation | More clusters to run and pay for |
| Shared cluster for several environments | Yes, as a prefix | Cheaper for small teams | Risk of mixing data; names must be changed per environment; noisy neighbors |
Separate clusters are the cleaner design. The application uses the same topic name in test and production, and only the connection address differs. This means the name is a stable business identity, not a deployment detail. It also reduces mistakes where a test program accidentally writes to a production topic.
If you must share a cluster
Use a short prefix such as dev, stg and prd, and make the prefix come from configuration, not from code. Add access rules so that test identities cannot touch production prefixes. Be strict about it, because a shared cluster removes the safety wall that separate clusters give.
Cluster and region names
When data is copied between clusters, for example for disaster recovery or for sharing across regions, replication tools often add the source cluster name to the topic name, such as us-east.sales.order-paid.v1. Plan for this. Your convention should not fight the prefix rules of the replication tool you choose, and you should decide whether consumers read the local copy, the remote copy, or both.
Think of a theatre rehearsal stage and the real stage. If both stages are identical and only the audience differs, actors need no extra directions. If both share one stage with tape marks on the floor, somebody will eventually walk onto the wrong mark during a live show.
If the same application runs in three environments, its code and its documentation stay simple when topic names are identical in all three.
13Access Control and Prefix Rules
Names and security work together. A good hierarchy lets one short rule cover many topics.
Kafka uses access control lists, called ACLs, to decide who may read from or write to a topic. An ACL rule can name one exact topic, or it can use a prefix, which matches every topic whose name begins with a given text. With prefix rules, “team billing may write to every topic starting with billing.” is one line. Without a good naming design, the same policy needs hundreds of lines that must be updated with each new topic.
| Goal | Rule idea | Naming requirement |
|---|---|---|
| Owner may write to its own domain | Allow write on prefix “sales.” | Domain is the first name part |
| Everyone may read public topics | Allow read on prefix “public.” | Visibility marker at the start |
| Only owner reads private topics | Allow read on the private prefix of one service | Service name in private topic names |
| Test identities blocked from production | Deny on production prefix | Environment prefix on shared clusters |
| Sensitive data restricted | Allow read only to named groups on a restricted prefix | Classification marker in the name or a dedicated prefix |
The first part of the name is the most valuable
Prefix rules can only look at the beginning of the name. Therefore, the part you most need to secure by, usually the domain or a visibility marker, must come first. Put a part at the end and it can be used for reading but not for prefix-based access rules.
Think of a building with keys for whole floors. If rooms are numbered by floor first, a key for “floor 3” is easy. If numbers were random, each room would need its own key and a long list to track.
A name that says “public” does not make a topic safe. Only real access rules protect data. Names help you write and review those rules, but they never replace them.
14Data Classification and Privacy in Names
Some topics carry personal or secret data. The name can signal how carefully to treat them, but it must never leak the data itself.
Data classification is a label that says how sensitive data is, for example public, internal, confidential and restricted. Companies use classification to decide encryption, retention, who may read it and how it may be copied.
Signal the level
Use a marker or a dedicated prefix so tools and people know that a topic holds confidential data.
Keep it in a catalog too
Names are short; a catalog or tags can hold richer labels such as data owner and legal basis.
Put personal data in names
No customer names, emails, phone numbers or identifiers. Topic names appear in logs and dashboards that many people can see.
Create a topic per person
A topic per customer does not scale and puts personal identifiers into names. Use one topic and message keys instead.
Why a topic per customer is a trap
Each topic has partitions, and each partition has files and memory costs on the brokers. Tens of thousands of tiny topics slow down cluster management. Naming problems come with it: customer identifiers land in names, logs and metrics. The better design is a single topic keyed by customer identifier, with access to the data controlled through application logic and encryption where needed.
Think of a hospital ward door. The door sign says “Restricted, staff only”. It does not list patient names. The sign warns you, and the lock does the protecting.
Rules such as data deletion requests are easier to meet when topics that hold personal data are easy to find. A consistent marker helps auditors and engineers locate them.
15Ownership and Metadata Beyond the Name
A name is short. Much of what people need to know belongs in metadata attached to the topic.
Names should carry only what is stable and needed for rules. Everything else, such as owner, contact channel, description, retention reasons, data classification and links to documents, should live in a topic catalog. A catalog is a searchable list of topics with details. It can be a dedicated tool, a shared repository of configuration files, or a simple registry.
| Information | In the name? | In the catalog? |
|---|---|---|
| Business domain | Yes | Yes |
| Entity or event | Yes | Yes, with a description |
| Major version | Yes | Yes |
| Owner team and contact | No, teams change | Yes |
| Retention and reason | No | Yes |
| Schema link | No | Yes |
| Data classification | Sometimes a marker | Yes |
| Service level, such as criticality | No | Yes |
| List of consumers | No | Yes |
Topics as code
Many teams keep topic definitions in a repository as configuration files. A definition lists the name, partitions, replication, retention and metadata. Changes go through review, and a tool applies them to the cluster. The repository then becomes the catalog and the audit trail. Naming rules can be checked automatically during review.
A book on a shelf has a short spine label, but its full record in the library system holds the author, the year, the owner and the borrowing history. The spine label lets you find it, and the record tells you everything else.
If you find yourself adding a part just to record who owns the topic, use metadata instead. Owners change; names cannot.
16Length, Readability and Search
Names are read by people and typed into tools. Keep them long enough to be clear and short enough to be usable.
Kafka allows 249 characters, but that is a ceiling, not a target. Long names are hard to fit into dashboards, hard to say in meetings, and easy to mistype. A practical target is under about fifty characters, with each part a short word or two.
| Readability test | Question |
|---|---|
| Say it aloud | Can a colleague understand it when you read it over the phone? |
| Guess the content | Could a new engineer guess what the topic holds without documentation? |
| Guess the owner | Is the owning area obvious from the first part? |
| Autocomplete | When you type the first part, do you get a helpful list? |
| Sort order | Do related topics sit next to each other in an alphabetical list? |
Sorting is a design tool
Lists of topics are usually sorted alphabetically. Because of this, the order of parts decides how things are grouped. With the domain first, all sales topics sit together. With the entity first, all order topics from different domains sit together, and ownership is scattered. Pick the order that matches how people browse.
Matching by pattern
Consumers can subscribe to topics by a pattern, and tools can select topics by pattern. Well-structured names make patterns simple. A pattern that means “every version one event topic in sales” is easy if parts are regular. It is impossible if names follow no shape.
A consumer that subscribes to a wide pattern will silently start reading any new topic that matches. That is convenient for logging tools and dangerous for business processors. Keep patterns narrow.
17Naming the Things Around Topics
Topics are not alone. Consumer groups, connectors, schemas and applications should follow related rules.
| Thing | Naming idea | Example |
|---|---|---|
| Consumer group | Owning service and purpose; one group per logical consumer | billing-invoicer |
| Client identifier | Service name and instance role, for quotas and logs | billing-invoicer-producer |
| Connector | Direction, system and entity | source-orders-database |
| Streams application identifier | Service and purpose; it becomes the prefix of internal topics | billing-order-totals |
| Transactional identifier | Service plus stable instance number | billing-writer-3 |
| Schema subject | Follows the topic name by default strategy | sales.order-paid.v1-value |
Schema subjects and topic names
A schema registry stores the message formats. Each format is saved under a subject. The default strategy builds the subject from the topic name plus “-key” or “-value”. That means topic names flow into schema subject names, so a clean topic name gives clean subjects. Other strategies use the record type name instead, which allows several kinds of events in one topic. Decide the strategy at the same time as the topic convention, since they affect each other.
Consumer groups tell the story of who reads what
When something is slow, people look at consumer groups. A group name such as “app1” says nothing. A name like “billing-invoicer” tells the reader who is behind the reading. Aligning group names with service names, and with the same domain words used in topics, makes incident work far quicker.
Think of naming rooms, keys and visitors in an office. If rooms are called “Finance Room 2” and keys are labeled “Finance Room 2 key”, nothing gets lost. If keys were labeled by colors nobody remembers, the locksmith gets rich.
Use the same domain words across topics, groups, connectors and dashboards. A shared vocabulary is the cheapest documentation there is.
18Governance: Who Creates Topics and How
A convention only works if topics are created through a controlled path. Otherwise the rules are suggestions.
Turn off automatic topic creation
Kafka can be set to create a topic automatically the first time a program writes to or reads from a name. This feature is handy in demos and harmful in production, because a single typo creates a real topic with default settings. Set the broker option for automatic creation to false in production clusters, so topics come into being only on purpose.
Choose a creation model
| Model | How it works | Good for | Risk |
|---|---|---|---|
| Central platform team | A team creates topics on request | Small organizations, strict control | Bottleneck and slow delivery |
| Self service with checks | Teams submit topic definitions; automation validates names and settings | Growing organizations | Needs tooling investment |
| Free for all | Anyone creates anything | Personal sandboxes only | Sprawl, clashes and cost |
What the checks should verify
Shape
Name matches the pattern: allowed characters, lowercase, correct number of parts, separators in the right places.
Vocabulary
The domain is on the approved list and the requesting team owns it.
Settings
Partitions, replication and retention fall within allowed ranges for that kind of topic.
Metadata
Owner, description and data classification are filled in.
Uniqueness
No near-duplicate exists, such as a name differing only by a dot or underscore.
If the approved path takes a week, people will find a way around it. Make the compliant path the fastest one.
19Enforcing the Convention with Automation
Rules that only exist in a document are forgotten. Rules that exist in a tool are followed.
flowchart TD A["Team writes topic definition"] --> B["Pull request opened"] B --> C["Automated name and settings check"] C -->|"Fails"| D["Feedback to the team"] D --> A C -->|"Passes"| E["Owner and platform review"] E --> F["Merge"] F --> G["Tool creates topic on the cluster"] G --> H["Catalog and access rules updated"]
In the figure, a team writes the definition as a file and opens a request for review. A robot checks the name and settings at once and returns errors in seconds. Humans review only the meaning. After the merge, a tool creates the topic and updates the catalog and access rules, so the cluster, the documents and the security stay in step.
Layers of enforcement
Review-time checks
A validation script or policy in the repository rejects bad names before they reach any cluster.
Broker-side policy
Kafka brokers accept a plug-in policy that can reject topic creation requests that break your rules, whatever tool made the request.
Access rules
Only the automation identity may create topics. People and applications have no permission to create them directly.
Scanning
A scheduled job lists all topics, flags names that do not match, and reports them to owners.
If you already have a messy cluster, begin by scanning and reporting. It shows the size of the problem without breaking anything, and it builds the case for stricter layers.
20Worked Example: An Online Store
Let us design a convention for a fictional online store step by step.
The store has several teams: catalog, checkout, payments, shipping and customer identity. It runs one production cluster and one test cluster. Data is shared between teams and there are a few sensitive topics that hold personal data.
Decisions
| Question | Decision | Reason |
|---|---|---|
| Separator and case | Dots between levels, hyphens inside words, all lowercase | Readable hierarchy without metric collisions |
| Environment in the name? | No; separate clusters | Identical names in every environment |
| Order of parts | domain, subdomain, kind and entity, version | Domain first for access rules and sorting |
| Kind of data | Suffix inside the entity part, such as order-paid for events and customer-state for state | Short names; past tense shows events |
| Version | Major only, last part | All versions sort together |
| Visibility | Public topics use the plain pattern; private topics start with the service name and the word internal | Simple prefix rules |
| Sensitive data | A confidential marker inside the domain part for topics with personal data | Easy to find and to restrict |
Resulting names
| Topic name | What it means |
|---|---|
| catalog.product.product-published.v1 | Event: a product became visible in the store |
| checkout.cart.order-placed.v1 | Event: a customer placed an order |
| payments.charge.payment-captured.v1 | Event: money for an order was taken |
| shipping.parcel.parcel-dispatched.v1 | Event: a parcel left the warehouse |
| identity.customer.customer-state.v2 | State: latest customer profile, second format edition, compacted |
| checkout-svc.internal.cart-work.v1 | Private working topic of the checkout service |
| checkout.cart.order-placed.v1.billing-invoicer.dlt | Dead letter topic of one consumer of the order event |
Notice how much a stranger can learn. The first word gives the owning area, the middle gives the object, the entity name says event or state, and the end gives the edition. Access rules also become short: the payments team may write to everything starting with “payments.”, and everyone may read public event topics through a small, reviewed list.
Think of a street map where every street is named on a pattern: district, avenue, house number. A visitor who has never been to the town can find any house. That is what the store’s topic names do for data.
21Cleaning Up an Existing Messy Cluster
Most teams do not start from a blank page. They inherit hundreds of topics with names nobody dares to touch. Here is a safe way forward.
Because a topic cannot be renamed, “fixing” a name means creating a new topic and moving traffic. That is real work with real risk, so it must be chosen carefully. Not every bad name deserves a migration. A useful rule is to migrate only when a bad name causes ongoing pain, such as security gaps, confusion in incidents, or blocked automation.
flowchart TD A["Scan all topics"] --> B["Classify: good, tolerable, harmful"] B --> C["Freeze new bad names"] C --> D["Pick harmful topics by value and risk"] D --> E["Create new named topic"] E --> F["Copy old data and dual write"] F --> G["Move consumers one by one"] G --> H["Retire old topic after safe period"]
Steps in plain words
Take inventory
List every topic, its size, its producers and its consumers. Consumer group listings and access logs help find who uses what.
Sort into three piles
Good enough, tolerable with an exception, and harmful. Be generous with the first two piles, since every migration costs effort.
Freeze the mess
Turn on the checks for all new topics immediately, so the pile stops growing while you clean.
Delete the dead
Many old topics have no consumers and no recent messages. Confirm with owners and delete them. This is the cheapest clean-up of all.
Migrate the harmful
Create the new topic, copy data with a replication or copy tool, have the producer write to both, and move consumers one at a time.
Retire the old topic
Stop writing to it, wait a full retention period, confirm no readers, then delete it.
Aliases through documentation
Kafka has no built-in alias feature. For topics you cannot migrate, record the “good name” in the catalog next to the real one, so people can search by the name they expect. Documentation is a weak substitute for a proper name, but it costs almost nothing.
Think of renaming streets in a city. You do not rename them all overnight. You put new signs on the worst confusing streets, keep a table that maps old names to new ones, and make sure every new street follows the new pattern from now on.
Copying a large topic uses network, disk and broker time. Schedule it away from peak hours and watch cluster metrics. Also check that message ordering and consumer positions are handled explicitly, since offsets in the new topic differ from the old.
22Topic Classes and Their Default Settings
When names reveal the kind of topic, you can apply the right settings by default.
Different kinds of topics want different settings. Retention decides how long messages stay. Compaction keeps only the newest message per key. Replication decides how many copies exist. Partitions decide how much parallel work is possible. If the name shows the class, templates can apply sensible defaults and reviewers can spot odd choices.
| Class | How the name shows it | Typical retention | Compaction | Notes |
|---|---|---|---|---|
| Business event | Past-tense entity name | Days to weeks, or longer if replay is needed | No | Replication of three is common for important data |
| State or table | Entity name ending in state | Kept indefinitely through compaction | Yes | Messages need a stable key |
| Command | Action phrase | Short, hours to days | No | Consumers must handle duplicates |
| Retry | Suffix retry with stage number | Short | No | Low volume |
| Dead letter | Suffix dlt | Longer, to give people time to investigate | No | Alert on any growth |
| Log or metrics stream | Domain such as logs or telemetry | Short, hours to days | No | High volume; may use cheaper settings |
| Private working topic | Service and internal markers | Short to medium | Depends | Owner decides |
The numbers above are typical starting points, not rules. Your legal, business and cost needs decide the real values. The table simply shows how a naming class can lead to a settings template, so that the person creating a topic answers one question, “which class is this?”, and inherits a tested set of defaults.
Think of a warehouse with zones: frozen goods, chilled goods, dry goods. The label on the door tells staff which temperature to set. Nobody measures the temperature for every box; they trust the zone.
A template keyed by class prevents forgotten settings, such as a state topic created without compaction, which is a common and costly mistake.
23Monitoring and Dashboards That Use Names
Every metric, log line and alert mentions a topic name. Good names make monitoring smarter.
Monitoring systems group and filter by text. With regular names, you can build one dashboard per domain, one alert per class, and one report per team without listing topics by hand. New topics appear in the right dashboards automatically because they match the pattern.
| Need | Pattern idea | Result |
|---|---|---|
| Domain dashboard | Names starting with the domain | One board for all sales topics, without maintenance |
| Dead letter alert | Names ending in dlt | One alert rule covers all present and future dead letter topics |
| Retry growth | Names containing retry | Early sign of a failing consumer |
| Version tracking | Names by entity across versions | See how much data still flows in old versions |
| Cost report | Group storage by domain | Charge or show costs back to each owner |
| Unowned topics | Names outside approved domains | Find stray topics to clean up |
What to watch per topic
Bytes and messages in and out
Shows growth, sudden drops and traffic spikes.
Consumer lag
Shows how far readers are behind. Group by consumer group name and topic.
Disk used
Reveals forgotten topics and retention mistakes.
Under-replicated partitions
Shows topics whose copies are not all in sync.
Failed produce and fetch
Shows authorization mistakes and size limit problems.
Time since last message
Reveals abandoned topics and stalled producers.
Monitoring tools slow down when there are too many distinct label values. Thousands of topics multiplied by many metrics can be heavy. Consistent grouping by domain keeps summaries useful even at large scale.
24Multi-Tenancy, Quotas and Cost Attribution
When many teams share a cluster, names help share it fairly.
Multi-tenancy means several teams, called tenants, use one cluster. To keep them from harming each other, operators use quotas, which limit how much traffic a client may send or receive, and access rules. Quotas are attached to client identities and users, not to topic names, yet naming discipline supports them: a client identifier that matches the owning service and a domain prefix that matches the owning team make it easy to see who is heavy and who to talk to.
Tenant prefixes
In some organizations every team gets a prefix, and all topics of that team begin with it. The team can then be given permission to create, alter and delete topics under its prefix and nowhere else. This delegates safe self-service: the team moves fast inside its own area, and the platform team does not review each name.
| Approach | Benefit | Caution |
|---|---|---|
| Team prefix | Easy delegation and cost attribution | Team names change; prefix may outlive the team |
| Domain prefix with owner in catalog | Stable names; owner can change | Requires a catalog to stay current |
| Separate clusters for large tenants | Strongest isolation | More cost and operations |
Cost attribution
Storage and traffic cost money. When each topic maps to one domain and each domain to one owner, you can total storage and throughput by domain and show each owner their share. People who see the bill tend to fix forgotten topics and oversized retention very quickly.
Think of an apartment block with a shared electricity supply. Each flat has its own meter labeled with the flat number. Without labeled meters, the bill is divided by guesswork and nobody saves energy.
Ask every application to set a meaningful client identifier. Logs, quotas and metrics will then tell you who is behind a heavy load.
25Topic Count, Performance and Scalability
A convention influences how many topics you create, and topic count has a real cost.
Each topic has one or more partitions, and each partition is stored as files on brokers and tracked in cluster metadata. Very large numbers of partitions increase memory use, recovery time after failures, and the load on the cluster’s control system. Modern Kafka versions handle far more partitions than older ones, but the cost is still real, and limits differ between self-managed and cloud services.
How naming design affects the count
One topic per event family
Related events can share a topic when ordering across them matters. The convention should allow this and say how to name such topics.
One topic per event type
Simple and clear, but topic count grows with the number of event types.
Topic per customer or per device
Leads to enormous counts. Use message keys instead.
Topic per day or per hour
Date-stamped topics multiply forever. Use retention to age data out of one topic.
The choice between one topic for many event types and many topics
If events must be read in exact order, such as “order created”, “order paid”, “order shipped” for one order, putting them in one topic keyed by order identifier preserves order. If events are independent, separate topics are simpler for consumers, who then only read what they need. Your convention should name the “family” topic by the entity, for example sales.order.v1, and the separate-event topics by event, for example sales.order-paid.v1. Pick one style per domain, and record why.
Think of a filing cabinet. One drawer per customer means thousands of drawers and a cabinet that fills the room. One drawer per kind of paper, with a folder tab per customer, is compact. Keys and folder tabs do the same job for messages.
A topic such as “orders-2026-09-29” looks tidy at first. After a year there are hundreds of them, consumers must be reconfigured daily, and permissions must be updated. Retention already does this job.
26Advantages, Disadvantages and Trade-offs
A strict convention brings order, and it also brings costs. Weigh both honestly.
Advantages of a strong convention
- Data is easy to find and understand.
- Access rules are short and reviewable.
- Monitoring and alerting can be automatic.
- Ownership and cost are clear.
- Versions allow safe change.
- New engineers become productive sooner.
- Audits and privacy work become easier.
Disadvantages and risks
- Time and effort to design, document and enforce.
- Rigid rules can feel slow to teams in a hurry.
- A bad early choice is expensive to undo.
- Long names are harder to read.
- Rules may not fit unusual cases.
- Needs upkeep as the business changes.
Key trade-offs
| Choice | One side | Other side |
|---|---|---|
| Strictness | Strict checks give consistency | Loose rules give speed and freedom |
| Detail in names | Rich names are self-explaining | Short names are readable and stable |
| Versions in names | Safe breaking changes | Extra copies and migration work |
| Environment in names | Cheap shared clusters | Separate clusters keep names identical and safe |
| Central control | Uniform quality | Distributed ownership is faster |
Traffic rules slow each driver a little, but they let thousands of cars share the road safely. A few drivers will grumble at the red light, yet everyone gets home.
27Failure Scenarios and Troubleshooting
Naming mistakes show up as strange incidents. Here is how to recognize them.
| Symptom | Likely naming cause | What to do |
|---|---|---|
| Topic creation refused, name “collides” with another | Dot and underscore versions of the same name | Choose one separator style and use the existing topic |
| Unexpected topic appears with default settings | Typo plus automatic creation switched on | Disable automatic creation; delete the stray topic; fix the client |
| Consumer reads messages it should not | Wildcard subscription matches a new topic | Narrow the pattern; tighten access rules |
| Access denied for a new topic | Name outside the team’s prefix | Rename in the definition or request the right prefix |
| Two teams write to what they think are different topics | Ambiguous generic name, such as events | Introduce domain names; migrate |
| Schema errors after moving a topic | Schema subject is tied to the old topic name | Register schemas under the new subject before switching |
| Cannot tell who owns a failing topic | No owner in name or catalog | Add owner metadata; enforce it at creation |
| Replicated copy has an unexpected name | Replication tool adds a cluster prefix | Plan for prefixes; document which copy to read |
flowchart TD
A["Unexpected topic or access problem"] --> B{"Is the name valid and in pattern"}
B -->|"No"| C["Find creator; fix definition; migrate or delete"]
B -->|"Yes"| D{"Does an access rule cover the prefix"}
D -->|"No"| E["Adjust the prefix rule or the name"]
D -->|"Yes"| F{"Does a schema subject match"}
F -->|"No"| G["Register schema under the right subject"]
F -->|"Yes"| H["Check client configuration and client identity"]
Each naming incident is a lesson for the convention. Add a rule or a check so the same mistake cannot happen twice.
28Design Patterns and Anti-patterns
Patterns that repeatedly work, and mistakes that repeatedly hurt.
Domain-first hierarchy
Context: Many teams share a cluster and need clear ownership.
Decision: Start every name with a stable business domain.
Consequence: Short prefix rules, grouped listings, stable names across reorganizations.
Topics as code with automatic checks
Context: Topics are created by many people.
Decision: Keep definitions in a repository and validate names on every change.
Consequence: Consistent names, an audit trail and fast feedback.
Major version suffix with dual-write migration
Context: A message format must change in a breaking way.
Decision: Create a new versioned topic and migrate readers gradually.
Consequence: No big-bang switch; extra storage for a limited time.
Suffix families for helper topics
Context: Retry and dead letter topics multiply.
Decision: Build their names from the source topic plus the consumer and a suffix.
Consequence: Related topics sort together and alerts match by pattern.
Vague generic names
Problem: Names like events, data, test2 or new-topic.
Effect: Nobody knows the content or the owner; collisions; permanent clutter.
Better: Always include domain and entity.
Encoding the owner or the tool
Problem: Names containing a person, a team nickname or a technology.
Effect: Names go stale when people, teams or tools change.
Better: Use business meaning; keep owners in a catalog.
Mixed styles
Problem: Some names with dots, some with underscores, some with capitals.
Effect: Metric collisions, failed patterns and confusion.
Better: One style, enforced by tools.
Topic per entity instance or per date
Problem: A new topic for each customer, device or day.
Effect: Huge topic counts and constant reconfiguration.
Better: Use keys and retention.
29Best Practices and Common Mistakes
A short list to take away and check against your own cluster.
Best practices
- Write the convention down with examples and a reason for each rule.
- Use lowercase, one separator style, and full words.
- Put the most important part for security and grouping first.
- Name business meaning, not tools, teams or people.
- Use past tense for events and stable keys for state.
- Version by major number only, and plan the retirement of old versions.
- Prefer separate clusters over environment prefixes.
- Disable automatic topic creation in production.
- Check names automatically at review time and at the broker.
- Keep owner, description and classification in a catalog.
- Scan regularly for stray, empty and unused topics.
- Review the convention once a year.
Common mistakes
- Starting without any convention because “we are small”.
- Copying a convention from another company without thinking.
- Making names too long or too clever.
- Mixing dots and underscores.
- Putting personal data in names.
- Letting clients create topics on the fly.
- Ignoring internal, retry and dead letter topics in the design.
- Keeping old versions forever.
- Relying on names instead of real access rules.
- Writing rules nobody can enforce.
A simple convention that every team follows is worth more than an elegant one that only its author understands. Start small, and grow it with real needs.
30Real-World Examples
These are illustrations of common situations, not reports about specific companies.
The startup that grew too fast
A small team named topics as they wished: “orders”, “orders2”, “payments-new”. After two years and forty engineers, nobody knew which was current. They adopted a domain-first convention, blocked new bad names, deleted dead topics, and migrated only the ten most confusing ones. Incident time fell noticeably because names finally told people where to look.
The bank with strict security
A financial organization needed to prove who could read customer data. Topics with personal data got a restricted prefix, and access rules were written on that prefix only. Auditors could read the rules in minutes, and new topics under the prefix were protected automatically.
The retailer with many stores
A retailer first created a topic per store. With hundreds of stores the cluster struggled. They moved to a single topic per event type keyed by store identifier. Names became short, topic count dropped, and new stores needed no new topics.
The platform team that offered self service
A platform team let product teams define topics in a repository. A validator checked names, domains and settings in seconds. Reviews focused on meaning instead of typos. The number of “please create a topic” tickets dropped sharply.
The breaking change done gently
A team had to change a customer message format in a way old readers could not handle. They created a version two topic, wrote to both for six weeks, moved readers one by one, and retired version one afterwards. No consumer was surprised and no outage occurred.
31A Convention Template You Can Adapt
Use this outline as the skeleton of your own written convention.
| Section | What to write |
|---|---|
| Purpose | Why the convention exists and who must follow it |
| Pattern | The order of parts, separators, case, allowed characters and maximum length |
| Vocabulary | Approved domains, approved abbreviations and the words for kinds of data |
| Public and private | How visibility is shown and what each promises |
| Versions | When a new version is required and how migrations run |
| Helper topics | Naming for retry, dead letter and internal topics |
| Related names | Consumer groups, clients, connectors, schemas and transactional identifiers |
| Security | Prefix rules, classification markers and forbidden content |
| Creation process | Who may create topics and through which tool |
| Metadata | Required catalog fields such as owner, description and classification |
| Exceptions | How to request one and who approves |
| Review | How and when the convention is revisited |
Tips for adoption
Involve the teams
Ask a few producers and consumers to review the draft. People follow rules they helped shape.
Provide examples
A dozen real example names teach faster than a page of rules.
Ship the checker with the rules
Give teams a script they can run locally so they know a name is valid before asking anyone.
Start with new topics
Apply the rules to new topics first and treat old ones with the clean-up plan.
Measure compliance
Track the share of topics that match and celebrate progress.
32Glossary
Plain meanings for the words used in this guide.
| Term | Meaning |
|---|---|
| Topic | A named stream of messages in Kafka. |
| Partition | One ordered slice of a topic. |
| Broker | A Kafka server that stores messages. |
| Producer | A program that writes messages. |
| Consumer | A program that reads messages. |
| Consumer group | A set of consumers that share the work of reading a topic. |
| Naming convention | A written rule for how names are built. |
| Domain | A business area with its own language and owner. |
| Event | A record of something that already happened. |
| Command | A request that something be done. |
| State topic | A topic holding the latest value per key, usually compacted. |
| Compaction | Keeping only the newest message for each key. |
| Retention | How long messages are kept. |
| Dead letter topic | A topic for messages that could not be processed. |
| Retry topic | A topic for messages waiting to be tried again. |
| ACL | An access control rule saying who may do what. |
| Prefix rule | A rule that matches all names starting with some text. |
| Schema registry | A service that stores message formats. |
| Subject | The name under which a schema is stored. |
| Catalog | A searchable list of topics with their details. |
| Topics as code | Keeping topic definitions in a reviewed repository. |
| Multi-tenancy | Several teams sharing one cluster. |
| Quota | A limit on how much a client may use. |
33Frequently Asked Questions
Short answers to questions that come up again and again.
Not in place. You create a new topic, copy the data, move producers and consumers, and retire the old topic.
Any of them works if you stay consistent. Dots between levels and hyphens inside words is a popular and safe choice. Avoid mixing dots with underscores because of metric name collisions.
Preferably not. Separate clusters per environment let the same name work everywhere. Use a prefix only on shared clusters, and take it from configuration.
It is helpful for public topics whose format may change in breaking ways. Some teams rely on schema compatibility rules and skip versions until needed. Decide once and be consistent.
Kafka allows up to 249 characters, but aim for well under fifty so names stay readable.
They are allowed and treated as different names from their lowercase forms. Use lowercase only to avoid confusion.
In a catalog, not in the name. Teams change, but names cannot. The domain part gives a stable hint of the owner.
Usually not. They have different lifetimes and meanings. Keep them apart and let the name show the difference.
With the default strategy, the subject is the topic name plus a key or value suffix. Choose the strategy with the topic convention.
A typo in a client would create a real topic with default settings and no owner. Turning the feature off means every topic is created on purpose.
Combine review-time checks, a broker-side creation policy, restricted permissions so only automation creates topics, and regular scans.
Delete the unused ones, migrate only the harmful ones, and record good names in the catalog for the rest. Stop new bad names at once.
No. It creates huge topic counts and puts identifiers in names. Use one topic with the customer identifier as the message key.
Usually not. The format is a technical detail that can change while the business meaning stays the same. Record the format in the schema registry and the catalog instead. A name that mentions a format becomes misleading the day the format changes, and renaming is expensive.
A small group, often the platform team together with representatives from a few product teams, should own it. They approve new domains, answer questions, handle exception requests and keep the written document current. Shared ownership prevents the rules from feeling like orders from a distant department.
Provide a simple exception path. The team explains the reason, the owners approve or decline it, and the exception is recorded in the catalog with an expiry date. Exceptions are healthy when they are visible and temporary. They become harmful when they are silent and permanent.
Once a year, and after any incident caused by naming. Small, careful updates keep it alive without breaking existing topics.
Only a short, approved list. Abbreviations save characters but cost clarity, especially for newcomers who do not know the local jargon. If two teams use the same abbreviation for different things, confusion follows. Publish the approved list in the convention, and prefer full words whenever the name stays reasonably short.
Run the checker against your existing topic list and see how many names would pass. Then try the rules on a handful of upcoming projects and ask the teams if the names felt natural. Adjust the pattern based on what you learn, and only then make the checks mandatory for all new topics.
34Summary and Key Takeaways
A topic name is a small piece of text that carries a large share of a cluster’s clarity, safety and cost.
Kafka permits many names but offers no guidance on choosing them. A good convention fills that gap: it picks one style, orders the parts from broad to specific, shows the kind and visibility of the data, marks versions only when needed, treats internal and helper topics with the same care, and is checked by tools instead of memory. Because names cannot be changed, the early decisions matter most, and the cheapest time to make them is before the cluster grows.
Remember also that a convention is a living agreement. Review it after incidents, listen to the teams who use it, keep the written guide short and full of examples, and let automation carry the boring checks so that people can spend their attention on the meaning of the data. Start today with one page, one checker script and one honest inventory of your existing topics.
Key Takeaways
- A topic name cannot be changed, so design it deliberately and early.
- Use lowercase, one separator style, and a broad-to-specific order with the business domain first.
- Name business meaning, not teams, people or tools; keep owners and details in a catalog.
- Show the kind of data and the major version in the name where it helps rules and migrations.
- Design prefix-based access rules and monitoring patterns around the name structure.
- Turn off automatic topic creation and enforce names through topics as code, broker policy and regular scans.
- Clean up old clusters gradually: stop new bad names, delete dead topics, and migrate only what is harmful.