Hello,
I  have subscribed to a kafka topic  as below . I need to run some logic
only after the consumer has been assigned a partition .How ever
consumer.assignment() comes back as an empty set no matter  how long I wait
. If I do not have the while loop and then do a  consumer.poll() I do get
the records from the topic.Can any one tell me why this is  happening ?

consumer.subscribe(topics);
      consumer.

      Set<TopicPartition> assigned=Collections.emptySet();
      while(isAssigned)
{
                      assigned = consumer.assignment();
                     if(!assigned.isEmpty()) {
                  isAssigned= false;
                           }
   }

Thanks,
Chinchu

Reply via email to