They implement generally the same consumer group functionality, but the new
consumer (your option 1) is more modern, will be supported for a long time
(whereas option 2 will eventually be deprecated and removed), and has a
better implementation. The new consumer takes into account a lot of lessons
learned from the original consumer implementation, doesn't require direct
interaction with Zookeeper (which generally makes it easier to deploy and
easier to secure Kafka). It also lets you use the interface both as the
"high level" consumer (i.e. consumer groups) or "simple consumer" (i.e.
consume from topic partitions directly without balancing consumption across
multiple processes).

Unless you run into a particular issue with the new consumer, I'd recommend
always using the new consumer now.

-Ewen

On Tue, Jul 5, 2016 at 11:59 AM, Yagnik Suchak <[email protected]> wrote:

> Hello,
>
> I am a newbie to Kafka and trying to understand the difference between the
> following two Kafka Consumer.
>
> 1.
>
> KafkaConsumer pooling
>
>
> http://kafka.apache.org/090/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html
> >>> consumer.poll(100);
>
>
> 2.
>
> ConsumerIterator and KafkaStream
>
> https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example
>
>
> I found the following discussion but if someone can provide more
> information on the same would be of great help.
>
>
> http://grokbase.com/t/kafka/users/15btnmvm43/0-9-0-client-streaming-vs-polling
>
>
> Please let me know if any additional details are required from my end.
>
> Thanks in advance,
> Yagnik
>



-- 
Thanks,
Ewen

Reply via email to