What we normally do is consumer.poll(0). This connects to the broker, finds the consumer group, handles partition assignment, gets the metadata - and then doesn't stick around to actually give you any data.
Pretty hacky, but we use this all over the place. Gwen On Tue, Mar 8, 2016 at 12:59 PM, Anas Mosaad <anas.mos...@incorta.com> wrote: > Hi All, > > I am new to Kafka, I want to make sure Kafka server is available before I > can do any polling to the messages. What I did is creating a consumer > without subscription and try to access the partitions metadata for a > specific topic. This trick works for the first time. If I take the brokers > down and get one up and test the connectivity, it fails. > > My problem is, I am not sure if this is the right way to ensure > connectivity. I appreciate any feedback about the best way to do this on > Kafka 0.9.0.1. > > Thanks! > > -- > > *Best Regards/أطيب المنى,* > > *Anas Mosaad* > *Incorta Inc.* > *+20-100-743-4510*