You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by "M. Manna" <ma...@gmail.com> on 2017/07/06 12:59:53 UTC

Order of ConsumerRecords obtained by records(TopicPartition) in Kafka Consumer API

Hello,

I had a question regarding records(TopicPartition partition) method in
ConsumerRecords<K,V>

I am trying to use auto.offset.reset=earliest and combine it with manual
offset control.
 I saw this sample code under "Manual Offset"

https://kafka.apache.org/0100/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html

From the API, I can see that records(TopicPartition) says:

> public List
> <http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true>
> <ConsumerRecord
> <https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/consumer/ConsumerRecord.html>
> <K
> <https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/consumer/ConsumerRecords.html>
> ,V
> <https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/consumer/ConsumerRecords.html>
> >> records(TopicPartition
> <https://kafka.apache.org/0100/javadoc/org/apache/kafka/common/TopicPartition.html>
>  partition)
> Get just the records for the given partition



I am assuming that the "order" of ConsumerRecord is maintained in the list
somewhere but couldn't find the source (probably exhausted eyes). Does
anyone know where to find the information about the ordering?

KR,