Class TopicNameStrategy

java.lang.Object
io.confluent.kafka.serializers.subject.TopicNameStrategy
All Implemented Interfaces:
SubjectNameStrategy, org.apache.kafka.common.Configurable

public class TopicNameStrategy extends Object implements SubjectNameStrategy
Default SubjectNameStrategy: for any messages published to <topic>, the schema of the message key is registered under the subject name <topic>-key, and the message value is registered under the subject name <topic>-value.
  • Constructor Details

    • TopicNameStrategy

      public TopicNameStrategy()
  • Method Details

    • configure

      public void configure(Map<String,?> config)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable
    • subjectName

      public String subjectName(String topic, boolean isKey, ParsedSchema schema)
      Description copied from interface: SubjectNameStrategy
      For a given topic and message, returns the subject name under which the schema should be registered in the schema registry.
      Specified by:
      subjectName in interface SubjectNameStrategy
      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.