-
Notifications
You must be signed in to change notification settings - Fork 70
Support catalog register new schema version #1246
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| public interface CatalogHandler | ||
| { | ||
| int NO_SCHEMA_ID = 0; | ||
| int NO_VERSION_ID = 0; | ||
|
|
||
| @FunctionalInterface | ||
| interface Decoder | ||
|
|
@@ -61,6 +62,13 @@ int accept( | |
| ValueConsumer next); | ||
| } | ||
|
|
||
| default int register( | ||
| String subject, | ||
| String schema) | ||
| { | ||
| return NO_VERSION_ID; | ||
| } | ||
|
|
||
|
Comment on lines
+65
to
+71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent. |
||
| String resolve( | ||
| int schemaId); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -126,7 +126,7 @@ public void attach( | |||||||||||||||||
|
|
||||||||||||||||||
| if (options.cataloged != null) | ||||||||||||||||||
| { | ||||||||||||||||||
| this.catalog = options.cataloged.size() != 0 ? options.cataloged.get(0).schemas.get(0) : null; | ||||||||||||||||||
| this.catalog = !options.cataloged.isEmpty() ? options.cataloged.get(0).schemas.get(0) : null; | ||||||||||||||||||
| this.catalogs = new LinkedList<>(); | ||||||||||||||||||
| for (CatalogedConfig catalog : options.cataloged) | ||||||||||||||||||
| { | ||||||||||||||||||
|
|
@@ -347,7 +347,11 @@ else if (assertion.schema != null && !assertion.schema.equals(schema)) | |||||||||||||||||
| } | ||||||||||||||||||
| else | ||||||||||||||||||
| { | ||||||||||||||||||
| if (catalog.subject != null && catalog.version != null) | ||||||||||||||||||
| if (catalog.subject != null && catalog.record != null) | ||||||||||||||||||
| { | ||||||||||||||||||
| handler.register(catalog.subject, catalog.record); | ||||||||||||||||||
| } | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
| else if (catalog.subject != null && catalog.version != null) | ||||||||||||||||||
| { | ||||||||||||||||||
| handler.resolve(catalog.subject, catalog.version); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # | ||
| # Copyright 2021-2023 Aklivity Inc | ||
| # | ||
| # Licensed under the Aklivity Community License (the "License"); you may not use | ||
| # this file except in compliance with the License. You may obtain a copy of the | ||
| # License at | ||
| # | ||
| # https://www.aklivity.io/aklivity-community-license/ | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| # WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations under the License. | ||
| # | ||
|
|
||
| --- | ||
| name: test | ||
| catalogs: | ||
| catalog0: | ||
| type: schema-registry | ||
| options: | ||
| url: http://localhost:8081 | ||
| bindings: | ||
| net0: | ||
| type: test | ||
| kind: server | ||
| options: | ||
| catalog: | ||
| catalog0: | ||
| - subject: items-snapshots-value | ||
| record: | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| { | ||
| "schema": | ||
| { | ||
| "type": "record", | ||
| "name": "test", | ||
| "fields": | ||
| [ | ||
| { | ||
| "type": "string", | ||
| "name": "field1" | ||
| }, | ||
| { | ||
| "type": "com.acme.Referenced", | ||
| "name": "int" | ||
| } | ||
| ] | ||
| }, | ||
| "schemaType":"AVRO" | ||
| } | ||
| exit: app0 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing leading slash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, no slash required. Spec is also correct
accept "http://localhost:8081/subjects/items-snapshots-value/versions"Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does
SUBJECT_VERSION_PATHstart with/subjects/...butSUBJECT_PATHstarts withsubjects/...?Seems like these should be consistent, and paths tend to start with
/, no?It's possible that the HTTP client is conveniently injecting the
/for us as a workaround for missing leading slash perhaps?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see what you mean I got it wrong yep :)