gpt4 book ai didi

apache-kafka-streams - Kafka Streams API 如何从模式注册表中获取正确的模式?

转载 作者:行者123 更新时间:2023-12-04 10:58:25 25 4
gpt4 key购买 nike

我试图了解 Kafka Streams API 如何与 Schema Registry 一起工作。

我知道您在设置应用程序时必须指定架构注册表 URL,但我无法理解我的应用程序如何在不指定主题名称或 ID 的情况下从注册表中检索正确的架构。

它使用主题名称检索模式?

最佳答案

I try to understand how Kafka Streams API works with Schema Registry.



Kafka Streams 通过在 Kafka Streams 应用程序中使用 Schema-Registry-aware Serde(串行器/解串器)与 Confluent Schema Registry 集成。如今,Schema Registry 仅支持 Avro 作为数据格式(计划添加 Protobuf 和 JSON 等其他格式),因此有一个与 Schema Registry 集成的 Avro Serde。见 Confluent 的 Kafka Streams documentation on 'Avro Serde' .

I know that you must specify Schema Registry URL when you setup your application And that is why, see above, you must specify the SR URL when configuring your Kafka Streams application, because this setting will be passed from Kafka Streams to the Avro Serde.

I cannot understand how my application retrieves correct schema from registry without specifying a subject name or ID.



Schema Registry 中的主题名称是主题名称和后缀的组合,即 -key-value取决于 Serde 是否分别用于序列化/反序列化 Kafka 消息键或 Kafka 消息值(参见 Schema Registry documentation on 'Subjects')。换句话说,有一个命名约定将 Kafka 主题(通过 Avro serde 从您的 Kafka Streams 应用程序读取或写入)和 Schema Registry 中的主题进行映射。

此外,一个模式可能有一个模式 ID,当有多个模式注册在同一主题(以及主题)下时,它用于消除模式解析的歧义。见 Schema Registry documentation on 'Schema IDs' .

关于apache-kafka-streams - Kafka Streams API 如何从模式注册表中获取正确的模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59022381/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com