如何使用kafka工具集生成具有空值的Kafka记录 [英] How can I produce a Kafka Record with null value using the kafka tool set
本文介绍了如何使用kafka工具集生成具有空值的Kafka记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下命令:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test.topic --property parse.key=true --property key.separator=#
这使我可以开始输入 key#value 条目.
This allows me to start typing key#value entries.
但是,无论我如何尝试,都无法创建空条目.
However, no matter what I try, I'm not able to create a null entry.
如果我尝试发送[myKey#]并按Enter,则在源上我会看到密钥为空的消息,但不会为空.
If I try sending [myKey#] and press Enter, on the feed I will see an Empty message for the Key, but not null.
我需要创建一个Null值.
I need to create a Null value.
推荐答案
控制台生产者无法产生空记录.它将输入解析为UTF8字符串
Console producer cannot produce a null record. It parses the input as UTF8 strings
我个人会编写一个简单的python或ruby脚本
Personally, I would write a simple python or ruby script to do so
这篇关于如何使用kafka工具集生成具有空值的Kafka记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文