Benoit Delbosc created KAFKA-9978:
-------------------------------------
Summary: Improve poll(Duration) and KafkaConsumer Javadoc
Key: KAFKA-9978
URL: https://issues.apache.org/jira/browse/KAFKA-9978
Project: Kafka
Issue Type: Improvement
Components: consumer
Affects Versions: 2.0.0
Reporter: Benoit Delbosc
Kafka 2.0.0 introduces {{poll(Duration)}} and deprecates {{poll(long)}}.
The new method behaves differently it can timeout and returns while the
consumer is in the middle of a rebalance.
In this case, invoking {{commitSync}} will fail, from Kafka 2.0 to 2.4 with a
{{CommitFailedException }}containing a wrong message related poll interval. In
Kafka 2.5.0 it raises a {{RebalanceInProgressException.}}
This behavior creates weird regressions when upgrading from Kafka 1.x and is
hard to understand because it is not reflected in the Javadoc.
For instance, the code snippet given in the KafkaConsumer Javadoc "Manual
Offset Control" explains that duplicates processing happens only in case of
failure. Since Kafka 2.0 this code will produce duplicates randomly depending
on rebalancing duration.
I think that Javadoc should be updated and provide code snippets based on
{{ConsumerRebalanceListener.}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)