简体   繁体   中英

Which partition the consumer is connected to?

  1. How can I get the partition the consumer is connected to?
  2. If it is subscribed to multiple topics, How to get metrics (incoming-byte-rate) for different topics from consumer.metrics() ?
  1. If you are part of a consumer group and are leveraging on the auto partitions assignment, every time partitions are assigned (due to a rebalance), the onPartitionsAssigned() (of the ConsumerRebalanceListener) is called with the collection of the assigned partitions. Btw in any moment you can call the assignment() method to get the assigned partitions.
  2. not quite sure but yes, the method metrics() should do the work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM