Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-9978

Improve poll(Duration) and KafkaConsumer Javadoc

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0
    • None
    • consumer
    • None

    Description

      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 to 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.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            bdelbosc Benoit Delbosc
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: