Anonymous
Использование плагина kafka-schema-registry-maven-plugin с родительскими и дочерними схемами
Сообщение
Anonymous » 30 сен 2024, 01:08
У меня есть проект, в котором есть три схемы: MetaModel.avsc, RevisionModel.avsc и RecentChangeEventModel.avsc. Где RecentChangeEventModel ссылается на остальные как на вложенные объекты, например:
Код: Выделить всё
{
"namespace": "org.taulin.model",
"type": "record",
"name": "RecentChangeEvent",
"fields": [
{
"name": "schema",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "meta",
"type": [
"null",
"Meta"
],
"default": null
},
{
"name": "id",
"type": [
"null",
"long"
],
"default": null
},
{
"name": "type",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "namespace",
"type": [
"null",
"int"
],
"default": null
},
{
"name": "title",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "titleUrl",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "comment",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "timestamp",
"type": [
"null",
"long"
],
"default": null
},
{
"name": "user",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "bot",
"type": [
"null",
"boolean"
],
"default": null
},
{
"name": "notifyUrl",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "serverUrl",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "serverName",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "serverScriptPath",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "wiki",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "parsedComment",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "minor",
"type": [
"null",
"boolean"
],
"default": null
},
{
"name": "patrolled",
"type": [
"null",
"boolean"
],
"default": null
},
{
"name": "length",
"type": [
"null",
"Revision"
],
"default": null
},
{
"name": "revision",
"type": [
"null",
"Revision"
],
"default": null
}
]
}
И у меня есть следующая конфигурация с плагином kafka-schema-registry-maven-plugin:
Код: Выделить всё
io.confluent
kafka-schema-registry-maven-plugin
7.7.1
http://localhost:8081/
${project.basedir}/src/main/avro/MetaModel.avsc
${project.basedir}/src/main/avro/RevisionModel.avsc
${project.basedir}/src/main/avro/RecentChangeEventModel.avsc
AVRO
AVRO
AVRO
Meta
Meta
Revision
Revision
RecentChangeEvent
RecentChangeEvent
register
Когда я пытаюсь выполнить mvn Schema-registry:register, возникает следующая ошибка:
Код: Выделить всё
[ERROR] Could not parse Avro schema
org.apache.avro.SchemaParseException: Undefined name: "org.taulin.model.Meta"
at org.apache.avro.Schema.parse (Schema.java:1697)
at org.apache.avro.Schema.parse (Schema.java:1823)
at org.apache.avro.Schema.parse (Schema.java:1736)
at org.apache.avro.Schema$Parser.parse (Schema.java:1471)
Я пробовал менять конфигурации плагинов и способ ссылки на каждую схему, но, похоже, ничего не работает. Похоже, что плагин не предназначен для использования, когда схемы ссылаются друг на друга таким образом.
Подробнее здесь:
https://stackoverflow.com/questions/790 ... ld-schemas
1727647697
Anonymous
У меня есть проект, в котором есть три схемы: MetaModel.avsc, RevisionModel.avsc и RecentChangeEventModel.avsc. Где RecentChangeEventModel ссылается на остальные как на вложенные объекты, например: [code]{ "namespace": "org.taulin.model", "type": "record", "name": "RecentChangeEvent", "fields": [ { "name": "schema", "type": [ "null", "string" ], "default": null }, { "name": "meta", "type": [ "null", "Meta" ], "default": null }, { "name": "id", "type": [ "null", "long" ], "default": null }, { "name": "type", "type": [ "null", "string" ], "default": null }, { "name": "namespace", "type": [ "null", "int" ], "default": null }, { "name": "title", "type": [ "null", "string" ], "default": null }, { "name": "titleUrl", "type": [ "null", "string" ], "default": null }, { "name": "comment", "type": [ "null", "string" ], "default": null }, { "name": "timestamp", "type": [ "null", "long" ], "default": null }, { "name": "user", "type": [ "null", "string" ], "default": null }, { "name": "bot", "type": [ "null", "boolean" ], "default": null }, { "name": "notifyUrl", "type": [ "null", "string" ], "default": null }, { "name": "serverUrl", "type": [ "null", "string" ], "default": null }, { "name": "serverName", "type": [ "null", "string" ], "default": null }, { "name": "serverScriptPath", "type": [ "null", "string" ], "default": null }, { "name": "wiki", "type": [ "null", "string" ], "default": null }, { "name": "parsedComment", "type": [ "null", "string" ], "default": null }, { "name": "minor", "type": [ "null", "boolean" ], "default": null }, { "name": "patrolled", "type": [ "null", "boolean" ], "default": null }, { "name": "length", "type": [ "null", "Revision" ], "default": null }, { "name": "revision", "type": [ "null", "Revision" ], "default": null } ] } [/code] И у меня есть следующая конфигурация с плагином kafka-schema-registry-maven-plugin: [code] io.confluent kafka-schema-registry-maven-plugin 7.7.1 http://localhost:8081/ ${project.basedir}/src/main/avro/MetaModel.avsc ${project.basedir}/src/main/avro/RevisionModel.avsc ${project.basedir}/src/main/avro/RecentChangeEventModel.avsc AVRO AVRO AVRO Meta Meta Revision Revision RecentChangeEvent RecentChangeEvent register [/code] Когда я пытаюсь выполнить mvn Schema-registry:register, возникает следующая ошибка: [code][ERROR] Could not parse Avro schema org.apache.avro.SchemaParseException: Undefined name: "org.taulin.model.Meta" at org.apache.avro.Schema.parse (Schema.java:1697) at org.apache.avro.Schema.parse (Schema.java:1823) at org.apache.avro.Schema.parse (Schema.java:1736) at org.apache.avro.Schema$Parser.parse (Schema.java:1471) [/code] Я пробовал менять конфигурации плагинов и способ ссылки на каждую схему, но, похоже, ничего не работает. Похоже, что плагин не предназначен для использования, когда схемы ссылаются друг на друга таким образом. Подробнее здесь: [url]https://stackoverflow.com/questions/79024857/using-kafka-schema-registry-maven-plugin-with-parent-and-child-schemas[/url]