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

  1. how can consume particular partition of topic? (for instance partition key 13)
  2. 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).

  1. 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)
  2. 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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -