Re: read N items from topic

2014-10-17 Thread Gwen Shapira
btw. I got a blog post where I show how I work around the blocking hasNext() thing. May be helpful: http://ingest.tips/2014/10/12/kafka-high-level-consumer-frequently-missing-pieces/ On Thu, Oct 16, 2014 at 12:52 PM, Neha Narkhede wrote: > Josh, > > The consumer's API doesn't allow you to specify

Re: read N items from topic

2014-10-16 Thread Neha Narkhede
Josh, The consumer's API doesn't allow you to specify N messages, but you can invoke iter.next() as Gwen suggested and count the messages. Note that the iterator can block if you have less than N messages so you will have to careful design around it. The new consumer's API provides a non blocking

Re: read N items from topic

2014-10-16 Thread gshapira
Using the high level consumer, each consumer in the group can call iter.next () in a loop until they get the number of messages you need. — Sent from Mailbox On Thu, Oct 16, 2014 at 10:18 AM, Josh J wrote: > hi, > How do I read N items from a topic? I also would like to do this for a > consume

read N items from topic

2014-10-16 Thread Josh J
hi, How do I read N items from a topic? I also would like to do this for a consumer group, so that each consumer can specify an N number of tuples to read, and each consumer reads distinct tuples. Thanks, Josh