Hi,
I am trying to write a consumer using the KafkaConsumer class from
https://github.com/apache/kafka/blob/0.8.2/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java.
My code is pretty simple with the snippet show below.However what I am seeing
is that I am not seeing any data out and the "records" variable is null.I know
I have data in the topic as I "pushed" data just before running this example
using the console writer that comes bundled with Kafka.
public static void main(String[] args) { Properties props =
new Properties(); props.put("metadata.broker.list",
"dtord01hdp0101d.int:9092"); props.put("bootstrap.servers",
"dtord01hdp0101d.int:9092");
props.put("partition.assignment.strategy", "roundrobin");
props.put("group.id", "test"); props.put("session.timeout.ms",
"1000"); props.put("enable.auto.commit", "true");
props.put("auto.commit.interval.ms", "10000"); KafkaConsumer
consumer = new KafkaConsumer(props); consumer.subscribe("*");
boolean isRunning = true; while(isRunning) {
Map<String, ConsumerRecords> records = consumer.poll(100);
System.out.println(records.keySet().size()); }
consumer.close(); }