kafka-python icon indicating copy to clipboard operation
kafka-python copied to clipboard

Dont allow producer to send messages with value=None to 0.8.0 brokers

Open wizzat opened this issue 12 years ago • 3 comments

python-kafka allows the insertion of a null value into a Kafka topic. Once this happens, the topic is rather permanently dead and no one can read from it. Details, including reproduction steps, are here: https://gist.github.com/wizzat/8970493

wizzat avatar Feb 14 '14 02:02 wizzat

Actually the issue is related with Kafka bug, not with kafka-python implementation. It really exists at 0.8 but was fixed for 0.8.1 (ConsoleConsumer failed when a null is passed for the value). I've tested it with 0.8.2 and it works fine:

./kafka-console-consumer.sh --topic test --zookeeper zk --from-beginning --property print.key=true                
null    null
null    abc

Should we handle such limitation in kafka-python code?

vshlapakov avatar Jun 17 '15 09:06 vshlapakov

the new KafkaProducer class will raise an AssertionError if value=None and api_version is < 0.8.1

dpkp avatar Jan 30 '16 19:01 dpkp

:+1:

vshlapakov avatar Jan 31 '16 07:01 vshlapakov