Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Schema Registry Subjects configurable #29

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

iturcino
Copy link

Fixes #2

Was planning to make this PR after #26 is merged, but doing it anyway.

Comment on lines -124 to +135
// TODO: Make the Strategy configurable, may be different for src and dest
// Strategy for the -key and -value subjects
this.subjectNameStrategy = new TopicNameStrategy();
// Strategy for the subjects
this.keySubjectNameStrategy = createSubjectStrategy(config.getString(ConfigName.KEY_SUBJECT_NAME_STRATEGY));
this.valueSubjectNameStrategy = createSubjectStrategy(config.getString(ConfigName.VALUE_SUBJECT_NAME_STRATEGY));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took me so long to review this.

Were you not able to make the source and destination use differing strategies? Or do you think that use case would ultimately cause confusion?

<confluent.patch.version>-cp1</confluent.patch.version>
<jackson.version>2.9.7</jackson.version>
<jackson.asl.version>1.9.13</jackson.asl.version>
<confluent.version>5.5.0</confluent.version>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to implement the feature without upgrades, IMO.

Can the version bump be a separate PR?

Comment on lines +896 to +898
assertTrue(destKeyVersions.isEmpty(), "the destination registry starts empty");
List<Integer> destValueVersions = destClient.getAllVersions(destValueSubject);
assertTrue(destValueVersions.isEmpty(), "the destination registry starts empty");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The message needs changed since you've already registered something in the destination

Comment on lines +841 to +843
String destKeySubject = TOPIC + "-" + keySchema.name();
//value subject in destination schema registry is topic-record name, NOT default topicName-value
String destValueSubject = TOPIC + "-" + valueSchema.name();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use TopicRecordNameStrategy to create these rather than manually?

Comment on lines +849 to +855
log.info("Registering schemas in source registry");
int sourceKeyId = sourceSchemaRegistry.registerSchema(TOPIC, true, keySchema);
final String keySubject = TOPIC + "-key";
assertEquals(1, sourceKeyId, "An empty registry starts at id=1");
int sourceValueId = sourceSchemaRegistry.registerSchema(TOPIC, false, valueSchema);
final String valueSubject = TOPIC + "-value";
assertEquals(2, sourceValueId, "unique schema ids monotonically increase");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding some comment that this is using TopicNameStrategy?

@@ -152,22 +154,22 @@ public void beforeEach(final ExtensionContext context) {
.willReturn(WireMock.aResponse().withTransformers(this.getVersionHandler.getName())));
this.stubFor.apply(WireMock.get(WireMock.urlPathMatching(CONFIG_PATTERN))
.willReturn(WireMock.aResponse().withTransformers(this.getConfigHandler.getName())));
this.stubFor.apply(WireMock.get(WireMock.urlPathMatching(SCHEMA_BY_ID_PATTERN + "\\d+"))
this.stubFor.apply(WireMock.get(WireMock.urlPathMatching(SCHEMA_BY_ID_PATTERN + "\\d+/(?:fetchMaxId=false)"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont think the capture group is necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Schema Registry Subjects configurable. Not ${topic}-(key|value)
2 participants