confluent-schema-registry icon indicating copy to clipboard operation
confluent-schema-registry copied to clipboard

Is there support for specifying Subject Name Strategy like TopicNameStrategy, RecordNameStrategy, TopicRecordNameStrategy?

Open sureshballa opened this issue 4 years ago • 3 comments

In Java, we can specify properties like value.subject.name.strategy, key.subject.name.strategy for producer configuration with respect to schema registration, with values like TopicNameStrategy, RecordNameStrategy, TopicRecordNameStrategy. Does this library support this feature?

https://docs.confluent.io/current/schema-registry/serdes-develop/index.html

Strategy Description
TopicNameStrategy Derives subject name from topic name. (This is the default.)
RecordNameStrategy Derives subject name from record name, and provides a way to group logically related events that may have different data structures under a subject.
TopicRecordNameStrategy Derives the subject name from topic and record name, as a way to group logically related events that may have different data structures under a subject.

sureshballa avatar Jul 13 '20 08:07 sureshballa

I see RecordNameStrategy is being used a default strategy with this library.

sureshballa avatar Jul 13 '20 08:07 sureshballa

Would be nice to have since we use a custom naming strategy

alex88 avatar May 11 '22 16:05 alex88

This client assumes RecordNameStrategy. You can override that by specifying subject in the options argument when registering a schema. Java and .NET clients use TopicNameStrategy by default. And the Confluent Control Center also assumes TopicNameStrategy in its UI (when you browse a given topic, the "schema" pages only list schemas if you're using that strategy).

It might be worth revising the official docs to underline the fact that this client assumes RecordNameStrategy by default, differing from how other clients behave (the docs already mentions what the default is, but doesn't point out how this differs from other clients). That could help guide developers in polyglot environments (and if you're using Kafka, there's a good chance you work for a large company and if it's a large company there's a good chance your devs are not all using JS clients) so they don't assume that using this client's defaults will play nice with Java/.NET/other clients' defaults.

benissimo avatar Jul 25 '22 17:07 benissimo