title: Kafka Consumer Assignment returns Empty Set
body: <p>I  have subscribed to a Kafka topic  as below. I need to run some logic only after the consumer has been assigned a partition.</p>
  
  <p>However <code>consumer.assignment()</code> comes back as an empty set no matter  how long I wait. If I do not have the while loop and then do a  <code>consumer.poll()</code> I do get the records from the topic.Can any one tell me why this is  happening ?</p>
  
  <pre class="lang-java prettyprint-override"><code>    consumer.subscribe(topics);
      Set&lt;TopicPartition&gt; assigned=Collections.emptySet();
      while(isAssigned) {
            assigned = consumer.assignment();
            if(!assigned.isEmpty()) {
                isAssigned= false;
            }
      }
  
  //consumer props
  Properties props = new Properties();
          props.put("bootstrap.servers", "xxx:9092,yyy:9092");
          props.put("group.id", groupId);
          props.put("enable.auto.commit", "false");
          props.put("session.timeout.ms", "30000");
          props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
          props.put("value.deserializer", "io.confluent.kafka.serializers.KafkaAvroDeserializer");
          props.put("schema.registry.url", "http://xxx:8081");
          props.put(KafkaAvroDeserializerConfig.SPECIFIC_AVRO_READER_CONFIG, true);
          props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
          props.put("max.poll.records", "100");
  </code></pre>