Search code examples
apache-kafkaavroconfluent-schema-registry

Why use Subject in Confluent's Schema Registry?


I'm starting to work with the Confluent Schema Registry. I realized that there is only one Schema per Subject.

What is exactly the use of the entity Subject in the registry, isn't it just a schema, that would be used for a topic in Kafka for example.

You can't really place more than one Schema in a Subject right?


Solution

  • A subject is a name under which the schema is registered, In Schema Registry, a subject can be registered depends on the strategy type.

    When schemas evolve, they are still associated with the same subject but get a new schema ID and version

    The default strategy is TopicNameStrategy.

    TopicNameStrategy - This is a good strategy where grouping by a message by topic is required.

    RecordNameStrategy and TopicRecordNameStrategy are used where grouping by topic name is not optional.

    Yes, We can't put more than one schema in one Subject.

    We can find more detailed information on the following URL. https://docs.confluent.io/current/schema-registry/serdes-develop/index.html#sr-schemas-subject-name-strategy