Topic names cannot be changed and stick around for a long time. The initial design directly shapes operational cost and reliability.
Based on the stable Kafka/Confluent specs, this article lays out naming patterns built around discoverability, permission design, and audit readiness. It also covers the official constraints that come up frequently on the CCDAK / CCAAK exams.
Naming is the entry point of operations. Good naming makes it easier to aggregate audit logs and metrics, to design ACL/RBAC prefixes, and to search efficiently during incidents. Ad hoc naming, on the other hand, breeds broken permissions, duplicate topics, and misrouted traffic.
CCDAK/CCAAK frequently tests understanding of the official naming constraints (allowed characters, case sensitivity, immutable names) and the default Schema Registry behavior (TopicNameStrategy). In real systems, tokenizing on top of these constraints (domain, entity, event kind, environment, region, version) results in a design that holds up against environment expansion and reorganizations.
Bad examples vs. good examples
# Bad (meaningless / no environment / mixed symbols)
orders
kafkaTopic1
sales:order|created
# Good (domain.entity.event.env.region.version)
sales.order.created.prod.eu-west-1.v1
risk.credit_decision.approved.stg.ap-northeast-1.v2Kafka topic names are part of the stable spec: only a limited character set is allowed, names are case-sensitive, and names cannot be changed. These behaviors have been preserved across versions for a long time (see the official Kafka documentation and Confluent Docs).
A common misconception: dots do not create a hierarchy (they are not a folder structure). Symbols like slash or colon are not allowed. The length limit depends on the implementation but is typically a few hundred characters (around 249 in many environments). In practice, target under 100 characters to leave headroom for tooling integrations and observability label limits.
Minimal validation example (regular expression)
# Quick check for allowed characters (example)
# Verify the name matches ^[A-Za-z0-9._-]+$
# To forbid leading/trailing or consecutive separators, extend the policy
pattern = r'^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?
NicheeLab を読み込み中…
#x27; # Test cases valid = [ 'sales.order.created.prod.eu-west-1.v1', 'etl_job.status._tmp-123' # allow or forbid per your rules ] invalid = [ 'sales/order', # slash not allowed 'order:created', # colon not allowed ' order', # leading whitespace not allowed 'chuumon', # non-ASCII not allowed (per the standard Kafka spec) ]
Prioritize operability and tokenize in this order: org.domain.entity.kind.env.region.version. kind is the data kind such as event, snapshot, command, or dlq. env is dev/stg/prod, region is the cloud or data center identifier, and version is incremented only on breaking changes.
Using dots for logical hierarchical splits, hyphens to join human-readable words, and underscores for fixed tokens or mechanical suffixes works well in practice.
| Separator | Primary use | Strengths | Caveats |
|---|---|---|---|
| . | Logical hierarchy splits (org.domain.entity.kind.env.region.version) | Great for PREFIXED ACLs and search; highly readable | The hierarchy is only a naming convention; there is no native hierarchical structure |
| - | Joining words (credit-decision, eu-west-1) | Human-readable; aligns with existing cloud naming | Avoid consecutive hyphens or trailing hyphens |
| _ | Mechanical suffixes and temporary use (_tmp, _dlq, etc.) | Stable as an identifier; easy to extract via tooling | Avoid proliferating meanings; do not abuse for permanent names |
Example breakdown of a recommended name
Example patterns and a recommended regular expression
# Examples
sales.order.created.prod.eu-west-1.v1
risk.credit_decision.snapshot.stg.ap-northeast-1.v2
common.schema.changelog.dev.us-central1.v1
# Stricter internal-policy example (no leading/trailing separators, no consecutive separators, 7 dot-delimited tokens)
# ^(?!.*[._-]{2})[A-Za-z0-9]+(?:[.-][A-Za-z0-9]+)*\.[A-Za-z0-9]+\.[A-Za-z0-9]+\.(event|snapshot|command|dlq)\.(dev|stg|prod)\.[A-Za-z0-9-]+\.(v[0-9]+)$Always tokenize the environment to prevent misrouted traffic. It surfaces producer/consumer misconfiguration early and helps separate monitoring labels. Region is essential for DR and multi-site operations.
Bump the version only when compatibility breaks, and retire the old topic gradually. Run old and new in parallel and migrate consumers first, which is the safe path. Because topic names cannot be changed, v1 and v2 coexist as separate topics.
Creation example (CLI)
# Example: kafka-topics (adjust tool name and options to your broker)
# Create sales.order.created.prod.eu-west-1.v1 with 3 partitions and replication factor 3
kafka-topics --bootstrap-server broker:9092 \
--create --topic sales.order.created.prod.eu-west-1.v1 \
--partitions 3 --replication-factor 3
# Run v2 in parallel
kafka-topics --bootstrap-server broker:9092 \
--create --topic sales.order.created.prod.eu-west-1.v2 \
--partitions 6 --replication-factor 3The default Subject Naming Strategy in Confluent Schema Registry is TopicNameStrategy, which creates a subject in the form <topic>-value. In other words, topic naming directly determines the subject structure for schemas. Aligning the naming lets you match the granularity of schema compatibility checks and audits.
ACL/RBAC pairs well with PREFIXED configuration, letting you safely delegate roles to groups of topics that share a common prefix. Treat naming conventions as part of the security design, not as an afterthought.
Example ACL (conceptual)
# Example: grant consume on sales.order.* (adjust the real CLI to your environment)
# kafka-acls --bootstrap-server broker:9092 \
# --add --allow-principal User:svc-analytics \
# --operation Read --topic "sales.order." --resource-pattern-type prefixed
# Schema subject illustration (TopicNameStrategy)
# Topic: sales.order.created.prod.eu-west-1.v1
# Subject: sales.order.created.prod.eu-west-1.v1-valueNaming conventions cannot stop at documentation; bake them into automated checks. Lint during PR, gate before creation, and manage owners and lifecycle in a catalog. A change-review workflow heads off duplicates and collisions.
For observability, extracting labels from topic names and auto-generating dashboards is highly effective. Reflecting tokens in alert names also makes auto-routing to the responsible team easy.
A simple naming linter (Bash + grep)
#!/usr/bin/env bash
# Company rule: org.domain.entity.kind.env.region.version
name="$1"
regex='^[A-Za-z0-9]+\.[A-Za-z0-9]+\.[A-Za-z0-9]+\.(event|snapshot|command|dlq)\.(dev|stg|prod)\.[A-Za-z0-9-]+\.(v[0-9]+)
NicheeLab を読み込み中…
#x27;
if [[ "$name" =~ $regex ]]; then
echo "OK: $name"
exit 0
else
echo "NG: $name (policy violation)" >&2
exit 1
fiCCDAK / CCAAK
問題 1
Which statement about Kafka topic names is correct?
正解: A
Kafka topic names allow alphanumerics plus . (period), _ (underscore), and - (hyphen), and are case-sensitive. Names cannot be changed. The Schema Registry default is TopicNameStrategy, which makes the subject <topic>-value.
Should environment tokens (dev/stg/prod) always be included?
Including them explicitly is the practical best practice to prevent accidental production traffic and to make monitoring easier to split. Even when clusters are fully separated by environment, keeping the token improves observability and the consistency of permission design.
I need a breaking change. Can I keep using the existing topic name?
Topic names cannot be changed, so create a new topic such as v2 and migrate gradually from producer to consumer. Run both in parallel and switch ACLs, monitoring, and alerts at the same time.
Is it OK to put a person's name or a temporary project name in the topic?
It works in the short term, but the naming will rot when ownership or domain ownership changes. Avoid personal names and use stable business vocabulary like domain, entity, and event kind. Restrict temporary usage to explicit, time-bound suffixes such as _tmp.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Kafka Topics & Partitions: Distribution Fundamentals (2026)
How Kafka topics and partitions enable scale — ordering guar...
CCDAK Exam Guide: Confluent Certified Developer (2026)
Complete prep for the CCDAK exam — Producer/Consumer API, St...
CCAAK Exam Guide: Confluent Certified Administrator (2026)
Pass the CCAAK exam — cluster management, partitions, securi...
Kafka Replicas & ISR: Fault Tolerance Explained (2026)
Replica placement, in-sync replicas (ISR), leader election. ...
Kafka Offsets: Commit Modes & Consumer Position (2026)
Offset semantics — auto vs. manual commit, __consumer_offset...