【问题标题】:How to ignore Avro schema by different Confluent Registry source?如何通过不同的 Confluent Registry 源忽略 Avro 模式?
【发布时间】:2020-04-26 17:01:44
【问题描述】:

我为一个主题使用不同的 Confluent Registry 源生成相同的 Avro 架构。使用此主题时出现错误:

org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition XXXXX_XXXX_XXX-0 at offset 0. If needed, please seek past the record to continue consumption.

Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 7

Caused by: org.apache.kafka.common.errors.SerializationException: Could not find class XXXXX_XXXX_XXX specified in writer's schema whilst finding reader's schema for a SpecificRecord.

如何忽略不同的 Avro 消息 ID?


架构:

 {
      "type": "record",
      "name": "XXXXX_XXXX_XXX",
      "namespace": "aa.bb.cc.dd",
      "fields": [
        {
          "name": "ACTION",
          "type": [
            "null",
            "string"
          ],
          "default":null,
          "doc":"action"
        },
        {
          "name": "EMAIL",
          "type": [
            "null",
            "string"
          ],
          "default":null,
          "doc":"email address"
        }
      ]
    }

产生的命令

{"Action": "A", "EMAIL": "xxxx@xxx.com"}

【问题讨论】:

  • 您能否分享为该主题生成和使用数据的架构和命令?

标签: java apache-kafka avro confluent-schema-registry


【解决方案1】:

不可能在生产者中使用不同的注册表 URL 并能够一致地使用它们。

原因是主题中会放置一个不同的ID。

无法跳过架构 ID 查找

如果您使用相同的注册表,则相同的架构负载将始终生成相同的 ID,然后消费者将能够一致地使用该 ID 来读取消息

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-11
    • 2017-10-06
    • 1970-01-01
    • 2020-01-25
    • 2023-02-13
    • 1970-01-01
    • 1970-01-01
    • 2022-12-27
    相关资源
    最近更新 更多