Hi, I have configured a kafka consumer as follows: Properties props = new Properties(); // ...... // Populated properties KafkaConsumer consumer = new KafkaConsumer(props);
// subscribe to partition "0" of topic test TopicPartition partition0 = new TopicPartition("test", 0); TopicPartition[] partitions = new TopicPartition[1]; partitions[0] = partition0; consumer.subscribe(partitions); System.out.println("Created consumer " + consumer); Consumer is getting created without any errors. Now I am following instructions on how to read from a partition using http://kafka.apache.org/083/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html . Here is a code snippet for the same: boolean isRunning = true; Map<TopicPartition, Long> consumedOffsets = new HashMap<TopicPartition, Long>(); while(isRunning) { Map<String, ConsumerRecords<byte[], byte[]>> records = consumer.poll(100); ....... ..... The consumer.poll() api is returning null always. Although the remaining code is based on the returned value from poll. Can you please let me know whether org.apache.kafka.clients.consumer.KafkaConsumer is a valid API to use if I want to create a client which can read from a given partition of a given topic. Best Regards, Sandeep