如何验证Confluent Kafka JsonSchema序列化消息的格式合规性?
Confluent KafkaJsonSchemaSerializer 消息格式验证疑问
Confluent KafkaJsonSchemaSerializer是否必须生成遵循「魔数字节(0x00或0x02)+4字节Schema ID+实际JSON负载」结构的Confluent wire格式消息?
我为验证该序列化器生成的消息格式,执行了以下步骤:
- 使用kafka-console-consumer拉取目标主题消息:
kafka-console-consumer.sh \ --bootstrap-server localhost:9092 \ --topic aicore-copilot-ap-client-metrics \ --offset 3600 \ --partition 0 \ --timeout-ms 1000 \ > /tmp/tst.txt
- 提取每条消息前10字节并转换为十六进制格式:
while IFS= read -r line; do echo -n "$line" | head -c 10 | xxd done < /tmp/tst.txt
输出结果显示,每条消息的首字节为0x1a,而非预期的0x00或0x02,且看起来缺少规范中要求的4字节Schema ID:
00000000 1a7b 226f 776e 6572 4964 - {"ownerId 00000000 1a7b 226f 776e 6572 4964 - {"ownerId 00000000 1a7b 226f 776e 6572 4964 - {"ownerId 00000000 1a7b 226f 776e 6572 4964 - {"ownerId
我需要向生产者团队提供该格式不符合规范的有效证据,但Confluent官方文档中缺少关于魔数字节的详细说明。
内容的提问来源于stack exchange,提问作者Priyanshu Sharma
相关产品推荐
相关产品推荐

