If both C1,C2 belongs to same consumer group, then the re-balance will be triggered. A consumer subscribes to event changes of the consumer id registry within its group.
On Mon, May 11, 2015 at 10:55 AM, dinesh kumar <dinesh...@gmail.com> wrote: > Hi, > I am looking at the code of kafka.consumer.ZookeeperConsumerConnector.scala > (link here > < > https://github.com/apache/kafka/blob/0.8.2/core/src/main/scala/kafka/consumer/ZookeeperConsumerConnector.scala > >) > and I see that all ids registered to a particular group ids are registered > to the path /consumers/[group_id]/ids in zookeeper. the ids contain the > consumer_id -> topics mapping. > > A watcher is registered in zookeeper that is triggered when there is a > change to /consumers/[group_id]/ids. This watcher event is handled by the > class ZKRebalancerListener. This class calls a synced rebalance whenever a > watcher event is received. > > So here is my question. > 1. Lets consider a scenario where there a two topics T1 and T2 and two > consumers C1 and C2. C1 consumes only from T1 and C2 only from T2. Say if > C2 dies for some reason as explained before, C1 will get a watcher event > from zookeeper and a synced rebalance will be triggered. Why does C2 dying > which has absolutely nothing with C1 (there is no intersection of topics > between C1 and C2) should trigger a rebalance event in C1. Is there some > condition where this is necessary that I am missing? > > Thanks, > Dinesh >