Still struggling :) Check following threads; - If my producer producing, then why the consumer couldn't consume? it stuck @ poll() - Consumer thread is waiting forever, not returning any objects
I think new APIs are recommended. On 4 April 2016 at 16:37, Lohith Samaga M <lohith.sam...@mphasis.com> wrote: > Thanks for letting me know. > > Is there any work around? A fix? > > Which set of API is recommended for production use? > > Best regards / Mit freundlichen Grüßen / Sincères salutations > M. Lohith Samaga > > > > > -----Original Message----- > From: Ratha v [mailto:vijayara...@gmail.com] > Sent: Monday, April 04, 2016 11.27 > To: users@kafka.apache.org > Subject: Re: New consumer API waits indefinitely > > I too face same issue:( > > On 4 April 2016 at 15:51, Lohith Samaga M <lohith.sam...@mphasis.com> > wrote: > > > HI, > > Good morning. > > > > I am new to Kafka. So, please bear with me. > > I am using the new Producer and Consumer API with > > Kafka > > 0.9.0.1 running on Windows 7 laptop with zookeeper. > > > > I was able to send messages using the new Producer > > API. I can see the messages in the Kafka data directory. > > > > However, when I run the consumer, it does not retrieve > > the messages. It keeps waiting for the messages indefinitely. > > My code (taken from Javadoc and modified) is as below: > > > > props.put("bootstrap.servers", "localhost:9092"); > > props.put("group.id", "new01"); > > props.put("enable.auto.commit", "true"); > > props.put("auto.commit.interval.ms", "1000"); > > props.put("session.timeout.ms", "30000"); > > props.put("key.deserializer", > > "org.apache.kafka.common.serialization.StringDeserializer"); > > props.put("value.deserializer", > > "org.apache.kafka.common.serialization.StringDeserializer"); > > > > KafkaConsumer<String, String> consumer = new > > KafkaConsumer<>(props); > > consumer.subscribe(Arrays.asList("new-producer")); > > while (true) { > > ConsumerRecords<String, String> records = > > consumer.poll(100); > > for (ConsumerRecord<String, String> record : records) > > System.out.printf("offset = %d, key = %s, value = > > %s", record.offset(), record.key(), record.value()); > > } > > > > Can anybody please tell me what went wrong? > > > > Thanks & Regards, > > M. Lohith Samaga > > > > Information transmitted by this e-mail is proprietary to Mphasis, its > > associated companies and/ or its customers and is intended for use > > only by the individual or entity to which it is addressed, and may > > contain information that is privileged, confidential or exempt from > > disclosure under applicable law. If you are not the intended recipient > > or it appears that this mail has been forwarded to you without proper > > authority, you are notified that any use or dissemination of this > > information in any manner is strictly prohibited. In such cases, > > please notify us immediately at mailmas...@mphasis.com and delete this > > mail from your records. > > > > > > -- > -Ratha > http://vvratha.blogspot.com/ > Information transmitted by this e-mail is proprietary to Mphasis, its > associated companies and/ or its customers and is intended > for use only by the individual or entity to which it is addressed, and may > contain information that is privileged, confidential or > exempt from disclosure under applicable law. If you are not the intended > recipient or it appears that this mail has been forwarded > to you without proper authority, you are notified that any use or > dissemination of this information in any manner is strictly > prohibited. In such cases, please notify us immediately at > mailmas...@mphasis.com and delete this mail from your records. > -- -Ratha http://vvratha.blogspot.com/