A frequent CCDAK focus on Schema Registry is not the schema itself but rather "which Subject anchors compatibility." How Subjects are named depends on the naming strategy, and it strongly influences schema evolution flexibility, reusability, and operational simplicity.
This article compares the three core strategies (TopicNameStrategy, RecordNameStrategy, TopicRecordNameStrategy) and gives selection guidance and configuration examples for real-world scenarios. It is grounded in official documentation behavior and tuned for both exam prep and field application.
Schema Registry versions schemas per "Subject" and evaluates compatibility per Subject. Producers register the schema under a Subject during serialization and embed only the Schema ID in messages. Consumers fetch the schema by ID. In other words, the wire format does not contain the Subject name; the Subject is a conceptual boundary for registration and compatibility management.
A naming strategy is the rule that decides this Subject name. The three main options are TopicNameStrategy (default), RecordNameStrategy, and TopicRecordNameStrategy. The choice changes the compatibility scope (limited to one topic, or spanning multiple topics).
Relationship between Producer/Consumer and Subjects
Producer Schema Registry Consumer
| | |
| 1) Serialize(value) | |
|--> subject resolved -----| |
| (by strategy) | |
| | 2) Register or lookup |
|-------------------------> | schema under Subject |
| | -> returns Schema ID |
| 3) Send record (ID+data) | |
|-----------------------------------------------------> |
| | 4) Fetch by Schema ID <----|
| | (subject not in wire) |
TopicNameStrategy is the safest and default strategy. Subjects split into <topic>-key and <topic>-value, and compatibility is evaluated independently for each topic's key and value. Even when different topics share the same schema, their evolutions do not interfere with each other.
The benefit is that change impact is contained within topic boundaries. The downside is that even when the same schema is shared across topics, Subjects are fragmented, causing duplicate schema registrations and fragmented compatibility policy management.
Configuration example: apply RecordNameStrategy for values and TopicNameStrategy for keys
Properties p = new Properties();
p.put("bootstrap.servers", "localhost:9092");
p.put("key.serializer", "io.confluent.kafka.serializers.KafkaAvroSerializer");
p.put("value.serializer", "io.confluent.kafka.serializers.KafkaAvroSerializer");
p.put("schema.registry.url", "http://localhost:8081");
// 既定はTopicNameStrategyだが、明示も可能
p.put("key.subject.name.strategy", "io.confluent.kafka.serializers.subject.TopicNameStrategy");
// 値だけRecordNameStrategyに切り替える例(混在可)
p.put("value.subject.name.strategy", "io.confluent.kafka.serializers.subject.RecordNameStrategy");
// 本番では自動登録を止め、最新利用へ切り替える選択肢もある
p.put("auto.register.schemas", false);
p.put("use.latest.version", true);
// 確認: 現在のSubject一覧
// curl http://localhost:8081/subjects
// 例: orders-key, orders-value, com.example.OrderCreated などが列挙されるRecordNameStrategy determines the Subject from Avro's fully qualified name (namespace.name) or the message name in Protobuf/JSON Schema. As a result, even when the same record is used across multiple topics, it consolidates into a single Subject, and compatibility policies are concentrated in one place.
The benefits are promoting schema reuse and centralizing compatibility policy. On the other hand, carelessly using the same fully qualified name for a different schema can cause collisions. Solid namespace design, naming conventions, and care to avoid reusing record names across keys/values are essential.
TopicRecordNameStrategy creates a Subject by combining the topic name with the fully qualified record name. It preserves topic-boundary independence while making it easy to distinguish different record names within the same topic. It is a balanced choice when adopting multi-event topics.
The table below organizes the three strategies by viewpoint. For CCDAK, focus on the often-asked points: "the scope of compatibility" and "when reuse is effective."
| Aspect | TopicNameStrategy | RecordNameStrategy | TopicRecordNameStrategy |
|---|---|---|---|
| Subject example | <topic>-key / <topic>-value | <namespace.name> | <topic>-<namespace.name> |
| Compatibility scope | Per topic's key/value | Across all topics by record name | Combination of topic × record name |
| Schema reuse | Low (tends toward duplicate registration) | High (consolidated into a single Subject) | Moderate |
| Collision risk | Low | Medium-high (same name with different schema collides) | Low to medium |
| Best-fit case | Independent topic operations, initial adoption | Shared event foundation, reusing the same event across multiple topics | Multi-event topics |
| Exam focus | Localizing impact scope | Cross-cutting compatibility and reuse | Balanced scope of application |
Compatibility levels (Backward/Forward/Full/Transitive, etc.) can be set as a global default and overridden per Subject. Regardless of the strategy, evaluation ultimately happens against "that Subject." Therefore, choosing RecordNameStrategy raises the responsibility of maintaining backward compatibility against a single Subject shared by multiple topics.
The combination of auto.register.schemas=false and use.latest.version=true helps with pre-registration and phased rollouts in production. Since producers do not autonomously create new schemas, you can more easily prevent compatibility breakage.
Inventory your current topics and events, and check which are shared across multiple topics. If sharing is heavy, RecordNameStrategy is natural; if topics are independent, TopicNameStrategy fits better. For multi-event topics, also consider TopicRecordNameStrategy.
Begin migration with new producer settings and leave existing messages as is. Since the wire format resolves via Schema ID, consumers are not affected. However, old and new Subjects coexist after migration. Monitor compatibility policies and the growth in Subject count on the Registry side.
CCDAK
問題 1
You want to share the same event type OrderCreated across multiple topics (orders, orders_dlq, orders_analytics) and manage schema compatibility centrally in one place. Which Subject naming strategy is appropriate?
正解: A
RecordNameStrategy uses the fully qualified record name as the Subject, so the same event type shared across multiple topics consolidates into a single Subject, making centralized compatibility management easy. TopicNameStrategy separates Subjects per topic, and TopicRecordNameStrategy separates them by topic × record name, so neither centralizes as effectively as RecordNameStrategy.
Where are compatibility levels configured, and what scope do they affect?
You can set them as a global default (/config) and per-subject (/config/{subject}). Evaluation happens at the Subject level, so regardless of the naming strategy, the final policy applied is the one defined for that specific Subject.
What happens if RecordNameStrategy uses the same fully qualified name for different schemas?
They collide on the same Subject and break registration or compatibility checks. You need strict namespace design, conventions for reusing record names, and schema reviews as part of your workflow.
Does switching from TopicNameStrategy to RecordNameStrategy affect consumers?
Typically not. The wire format only carries the Schema ID, and consumers resolve schemas by ID. The new strategy registers under a new Subject, but existing messages keep IDs tied to the old Subject. During migration, monitor coexisting Subjects and compatibility settings.
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...