Class RecordNameStrategy
java.lang.Object
io.confluent.kafka.serializers.subject.RecordNameStrategy
- All Implemented Interfaces:
SubjectNameStrategy,org.apache.kafka.common.Configurable
- Direct Known Subclasses:
TopicRecordNameStrategy
For any record type that is published to Kafka, registers the schema
in the registry under the fully-qualified record name (regardless of the
topic). This strategy allows a topic to contain a mixture of different
record types, since no intra-topic compatibility checking is performed.
Instead, checks compatibility of any occurrences of the same record name
across all topics.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected StringgetRecordName(ParsedSchema schema, boolean isKey) If the schema is a record type, returns its fully-qualified name.subjectName(String topic, boolean isKey, ParsedSchema schema) For a given topic and message, returns the subject name under which the schema should be registered in the schema registry.booleanWhether the strategy depends on the schema.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.confluent.kafka.serializers.subject.strategy.SubjectNameStrategy
setSchemaRegistryClient
-
Constructor Details
-
RecordNameStrategy
public RecordNameStrategy()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceorg.apache.kafka.common.Configurable
-
usesSchema
public boolean usesSchema()Description copied from interface:SubjectNameStrategyWhether the strategy depends on the schema.- Specified by:
usesSchemain interfaceSubjectNameStrategy- Returns:
- Whether the strategy depends on the schema.
-
subjectName
Description copied from interface:SubjectNameStrategyFor a given topic and message, returns the subject name under which the schema should be registered in the schema registry.- Specified by:
subjectNamein interfaceSubjectNameStrategy- Parameters:
topic- The Kafka topic name to which the message is being published.isKey- True when encoding a message key, false for a message value.schema- the schema of the record being serialized/deserialized- Returns:
- The subject name under which the schema should be registered.
-
getRecordName
If the schema is a record type, returns its fully-qualified name. Otherwise throws an error.
-