apache zookeeper - Consume and produce message in particular Kafka partition? -
for reading partitions in topic:
~bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic mytopic --from-beginning
- how can consume particular partition of topic? (for instance partition key 13)
- and how produce message in partition particular partition key? possible?
you can't using console consumer , producer. can using higher level clients (in language works you).
- you may use example
assign
method manually assign specific topic-partition consume (https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/kafkaconsumer.java#l906) - you may use custom
partitioner
override partitioning logic decide manually how partition messages (https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/producerconfig.java#l206-l208)
Comments
Post a Comment