Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We've observed that many usage of the consumer`consumer.committed committed` calls are not only for a single partition, but for a batch of partitions. On the other hand, the OffsetFetchRequest protocol actually allows for multiple partitions within one request.

So it's a natural proposal to extend our existing `consumer#committed` function to take a list set of topic-partitions.

Public Interfaces

Briefly list any new interfaces that will be introduced as part of this proposal or any existing interfaces that will be removed or changed. The purpose of this section is to concisely call out the public contract that will come along with this featureWe propose to add two overloaded function of `consumer#committed` that takes a set of topic-partitions, and deprecate the existing two functions that only take one topic-partition. At the moment the latter would be implemented as passing in a singleton set to the newly added functions.

Code Block
languagejava
@Deprecated 
OffsetAndMetadata committed(TopicPartition partition); OffsetAndMetadata committed(TopicPartition partition); /** /** * @see KafkaConsumer#committed(TopicPartition, Duration) * @see KafkaConsumer#committed(TopicPartition, Duration) */ */ @Deprecated 

@Deprecated 
OffsetAndMetadata committed(TopicPartition partition, final Duration timeout); OffsetAndMetadata committed(TopicPartition partition, final Duration timeout); /** * @see KafkaConsumer#committed(Set) */ 

Map<TopicPartition, OffsetAndMetadata> committed(Set<TopicPartition> partitions); /**/ * @see KafkaConsumer#committed(Set, Duration) */ new API

Map<TopicPartition, OffsetAndMetadata> committed(Set<TopicPartition> partitions, final Duration timeout); // new API


Proposed Changes

Describe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgement based on the scope of the change.As above. Internal implementations are straight-forward and would not be discussed here.


Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users?
  • If we are changing behavior how will we phase out the older behavior?
  • If we need special migration tools, describe them here.
  • When will we remove the existing behavior?

Rejected Alternatives

  • There is no direct impact on users since we only add new overloaded functions while deprecating the old ones.
  • When we eventually remove the deprecated functions users need to change their code to call the new functions with singleton set.

Rejected Alternatives

NoneIf there are alternative ways of accomplishing the same thing, what were they? The purpose of this section is to motivate why the design is the way it is and not some other way.