You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by "Sybrandy, Casey" <Ca...@Six3Systems.com> on 2013/10/01 15:03:23 UTC

Iterator Question

Hello,

What's the difference between the .toIterator() and .iterator() methods for KafkaStream?  I see they return different types and one of my coworkers is noticing that when he uses .toIterator() will block at times where .iterator() will not block.

Casey


Re: Iterator Question

Posted by Neha Narkhede <ne...@gmail.com>.
It is recommended you use the iterator() API since that invokes Kafka's
ConsumerIterator which has state management logic for consuming Kafka
messages properly. If you use toIterator(), it just gives you a plain Scala
iterator over KafkaStream.

Thanks,
Neha


On Tue, Oct 1, 2013 at 6:03 AM, Sybrandy, Casey <
Casey.Sybrandy@six3systems.com> wrote:

> Hello,
>
> What's the difference between the .toIterator() and .iterator() methods
> for KafkaStream?  I see they return different types and one of my coworkers
> is noticing that when he uses .toIterator() will block at times where
> .iterator() will not block.
>
> Casey
>
>