apache-kafka - how to enforce schema validation in kafka
问题描述
I'm using Kafka & Schema-registry. Defined a schema, using confluent's KafkaAvroSerializer on the producer side. Everything works fine.
On the other hand, if a producer publishes the event without adhering to the schema, it gets published without any problem.
Understood that Kafka gets just serialized binary, doesn't inspect the data and functionality works as designed.
Wondering if there is any better way to enforce stronger schema validation so that the topic is not polluted with bad data ?
解决方案
创建主题时使用以下“--config”标签。它们分别对值和键强制执行消息模式验证。这两条规则是相互独立的;您可以启用其中一个或两个。不合规的消息将导致客户端收到来自 kafka 代理的错误。
https://www.confluent.io/blog/data-governance-with-schema-validation/
confluent.value.schema.validation=true
confluent.key.schema.validation=true
推荐阅读
- react-native - 根据旋转/大小更改平面列表列数的脚本问题
- angular - 如何将传入的推送通知保存到角度的历史记录中
- java - 我正在用 Java 序列化一个对象,但在反序列化时,它的状态并不像预期的那样。如何保留对象的状态?
- python - 如何计算一个数字是否是另一个数字的幂?
- c# - 重命名 explorer.exe 并以新名称使用它的任何方式
- python - 类型错误:listdir:路径应该是字符串、字节、os.PathLike 或 None,而不是元组
- javascript - react hooks first dispatch 导致其他 muplitple dispatch 触发两次
- typescript - 为什么非导出类型从 TS 声明文件中隐式导出,导入但没有导出?这是一个错误吗?
- stl - 我可以在 DriverKit 驱动程序中使用 STL 吗?
- android - Flutter如何检查是否有设备通过蓝牙连接到我的设备