Class AssociatedNameStrategy
java.lang.Object
io.confluent.kafka.serializers.subject.AssociatedNameStrategy
- All Implemented Interfaces:
SubjectNameStrategy,org.apache.kafka.common.Configurable
A
SubjectNameStrategy that will query schema registry for
the associated subject name for the topic. The topic is passed as the resource name
to schema registry. If there is a configuration property named
"kafka.cluster.id", then its value will be passed as the resource namespace;
otherwise the value "-" will be passed as the resource namespace.
If more than subject is returned from the query, an exception will be thrown.
If no subjects are returned from the query, then the behavior will fall back
to TopicNameStrategy, unless the configuration property
"fallback.subject.name.strategy.type" is set to "RECORD", "TOPIC_RECORD", or "NONE".-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidSet the schema registry client.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.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
usesSchema
-
Field Details
-
KAFKA_CLUSTER_ID
- See Also:
-
NAMESPACE_WILDCARD
- See Also:
-
FALLBACK_SUBJECT_NAME_STRATEGY_TYPE
- See Also:
-
-
Constructor Details
-
AssociatedNameStrategy
public AssociatedNameStrategy()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceorg.apache.kafka.common.Configurable
-
setSchemaRegistryClient
Description copied from interface:SubjectNameStrategySet the schema registry client.- Specified by:
setSchemaRegistryClientin interfaceSubjectNameStrategy
-
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.
-