Can a single call of poll return more than one records from a single partition?

Viewed 28

Based on the doc, https://kafka.apache.org/25/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#poll-java.time.Duration-

a poll method returns ConsumerRecords<K,V> which is a wrapper on top of Map<TopicPartition,List<ConsumerRecord<K,V>>> records, so I suspect the answer is, yes, a single invocation of poll method can return more than one records from the same partition, but I just need to be sure.

I understand that it may definitely return multiple records when a consumer is listening on multiple partitions... but can it also return multiple records from the same partition in the poll() method?

1 Answers

Yes, it can return up to max.poll.records, default 500 per partition.

Related