Thanks Cees for the help..Yes i was trying to produce the messages before
consumer starts. Now i changed the order,

   1. I published messages and started the listener ---> No success
   2. I set the "auto.offset.reset" property to *earliest  --> No success*
   3. *T*hought may be my messages are not published, so started the
   consumer shell script (default tool in the kafka distribution), that
   consumes my messages well.


Do you think any other issues from my end?

Thanks

On 30 March 2016 at 05:28, Cees de Groot <c...@pagerduty.com> wrote:

> If you publish messages before you start the consumer, not that consumers
> by default start from the end of a queue. This is to prevent consumers from
> being overwhelmed with old messages when they start. The auto.offset.reset
> setting of the consumer can influence this behavior.
>
> On Tue, Mar 29, 2016 at 6:49 AM, Ratha v <vijayara...@gmail.com> wrote:
> >
> > Hi all;
> > I use kafka 0.9.0.1.
> > I publish 10 messages to my kafka server, but when i try to use my
> > consumer, it does not retriev any messages.
> > In the following code snippet, it prints 111 and 222 and thread runs
> > forever without sending any records :(
> >
> > I set consumer.timeout property, but nothing helps me..
> >
> > Can anybody help me?
> >
> > public void run() {
> >
> > try {
> >
> > consumer.subscribe(topics);
> >
> > System.out.println("111");
> >
> > while (true) {
> >
> > System.out.println("2222");
> >
> > ConsumerRecords<String, RawFile> records = consumer.poll(100);
> >
> > System.out.println("3333 : "+records.count());
> >
> > for (ConsumerRecord<String, RawFile> record : records) {
> >
> > System.out.println("4444");
> >
> > FileProcessor processor = new FileProcessor();
> >
> > processor.processFile(record.value());
> >
> >
> > }
> >
> > }
> >
> >
> > } catch (Throwable e) {
> >
> > e.printStackTrace();
> >
> > System.out.println("eror in polling");
> >
> >
> > } finally {
> >
> > consumer.close();
> >
> > }
> >
> > }
> > --
> > -Ratha
> > http://vvratha.blogspot.com/
>
>
>
>
> --
> Cees de Groot
> Principal Software Engineer
> PagerDuty, Inc.
>



-- 
-Ratha
http://vvratha.blogspot.com/

Reply via email to