...
No new public interfaces are introduced, but changes to the existing ones are introduced:
Code Block | ||
---|---|---|
| ||
void subscribe(Collection<String> topics); void subscribe(Collection<String> topics, ConsumerRebalanceListener); void assign(Collection<TopicPartition> partitions); void pause(Collection<TopicPartition> partitions); void resume(Collection<TopicPartition> partitions); void seekToBeginning(Collection<TopicPartition>); void seekToEnd(Collection<TopicPartition>); |
...
Code Block | ||
---|---|---|
| ||
void subscribe(java.util.List<java.lang.String> topics); void subscribe(java.util.List<java.lang.String> topics, ConsumerRebalanceListener listener); void assign(java.util.List<TopicPartition> partitions); void pause(TopicPartition... partitions); void resume(TopicPartition... partitions); void seekToBeginning(TopicPartition... partitions); void seekToEnd(TopicPartition... partitions); |
...
Proposed Changes
The proposed change boils down to the public interface changes above. If the first patch KAFKA-3006 is accepted, a standardization of signatures in Kafka Connect should also be considered.
...
- Code that used the previous array based signatures will have to be adapted.
- JVMs that depend on both the 0.9.0.0 client and later versions would have incompatible signatures.
- These drawbacks are mitigated by the fact that KafkaConsumer is annotated with @InterfaceStability.Unstable.
- java.util.Collection was chosen because it is a super-type of java.util.Set and java.util.List which are used as return types for partitionsFor and assignment.
- java.util.Collection as the nice added benefit of providing simple interaction with other JVM languages.
Rejected Alternatives
An alternative would be to keep the array-based versions of the calls and mark them as deprecated but this has not gathered much interest. This KIP also supersedes some of the propositions outlined in KAFKA-2991
...