zookeeper - Produce Kafka message to selected partition -
zookeeper - Produce Kafka message to selected partition -
according kafka documentation:
the producer responsible choosing message assign partition within topic.
therefore main question is:
how can send message selected partition using kafka-console-producer.sh (or kafka java client)?
i specify sort of 'partition id' @ message sending. such 'partition id' stored somewhere in zookeeper. know 1 value (in zookeeper) identifies kafka partition?
kafka-console-producer.sh doesn't back upwards producing messages particular partition out of box.
however should pretty straightforward update script pass parameter partition id , handle in custom partitioner described in post @chiron in modified version of kafka.tools.consoleproducer class.
take @ source code at:
https://apache.googlesource.com/kafka/+/refs/heads/trunk/bin/kafka-console-producer.sh https://apache.googlesource.com/kafka/+/refs/heads/trunk/core/src/main/scala/kafka/tools/consoleproducer.scala
zookeeper apache-kafka
Comments
Post a Comment