As Manikumar mentioned the code in 0.8.2 is not released and that class is
just a stub (it doesn't do anything yet). If you would like to try out the
new consumer you can try it on trunk. However be aware that it doesn't yet
do partition balancing among topics as that is pending server side work.
However it can work as a more convenient (but alpha quality) replacement
for a simple consumer.

-Jay

On Thu, Feb 12, 2015 at 11:36 PM, Manikumar Reddy <ku...@nmsworks.co.in>
wrote:

> New KafkaConsumer is not yet released.  It is planned for 0.9.0 release.
>
> On 2/13/15, Jayesh Thakrar <j_thak...@yahoo.com.invalid> wrote:
> > 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();       }
> >
> >
> >
>

Reply via email to