Apache kafka 卡夫卡;Avro producer-正在注册的架构与主题的早期架构不兼容
我正在使用本地服务器运行schema registry confluent示例,修改消息的架构时出错: 这是我的模式:Apache kafka 卡夫卡;Avro producer-正在注册的架构与主题的早期架构不兼容,apache-kafka,avro,confluent-schema-registry,Apache Kafka,Avro,Confluent Schema Registry,我正在使用本地服务器运行schema registry confluent示例,修改消息的架构时出错: 这是我的模式: { "type": "record", "namespace": "io.confluent.tutorial.pojo.avro", "name": "OrderDetail", "fields": [ {
{
"type": "record",
"namespace": "io.confluent.tutorial.pojo.avro",
"name": "OrderDetail",
"fields": [
{
"name": "number",
"type": "long",
"doc": "The order number."
},
{
"name": "date",
"type": "long",
"logicalType": "date",
"doc": "The date the order was submitted."
},
{
"name": "client",
"type": {
"type": "record",
"name": "Client",
"fields": [
{ "name": "code", "type": "string" }
]
}
}
]
}
我试着在制作人身上传达这样的信息:
{"number": 2343434, "date": 1596490462, "client": {"code": "1234"}}
但我有一个错误:
org.apache.kafka.common.errors.InvalidConfigurationException: Schema being registered is incompatible with an earlier schema for subject "example-topic-avro-value"; error code: 409
您在模式中到底修改了什么?它以前是什么样子的?关于错误消息,您不了解什么?主题“示例主题avro值”的模式的早期版本是什么?我不理解为什么它不是该模式的有效消息。我只添加了“客户机”,如果我删除了它,那么一切正常。我在向现有架构添加新字段时也遇到了类似的问题,在向新添加的字段添加默认值后,它就正常工作了。我猜原因是,如果新模式没有新字段的默认值,则旧记录无法反序列化。