...
Currently AdminClient supports describeTopics(Collection<String> topicNames) method for describing topics and listTopics() for topic name listing.
To describe all topics, users currently use listTopics() to get all topic names and pass the name list to describeTopics.
Since "describe all topics" is a common operation, We propose to add describeTopics() method to get all topic descriptions in single call.
This will be simple to use and avoids additional metadata requests.
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 feature.
A public interface is any change to the following:
...
Binary log format
...
The network protocol and api behavior
...
Any class in the public packages under clientsConfiguration, especially client configuration
org/apache/kafka/common/serialization
org/apache/kafka/common
org/apache/kafka/common/errors
org/apache/kafka/clients/producer
org/apache/kafka/clients/consumer (eventually, once stable)
...
Monitoring
...
Command line tools and arguments
Code Block |
---|
/**
* Describe all topics in the cluster, with the default options.
*/
public DescribeAllTopicsResult describeTopics() {
return describeTopics(new DescribeTopicsOptions());
}
/**
* Describe all topics in the cluster.
*
* @return The DescribeAllTopicsResult.
*/
public abstract DescribeAllTopicsResult describeTopics(DescribeTopicsOptions options);
/**
* The result of the {@link KafkaAdminClient#describeTopics()} call.
*/
public class DescribeAllTopicsResult {
private final KafkaFuture<Collection<TopicDescription>> future;
DescribeAllTopicsResult(KafkaFuture<Collection<TopicDescription>> future) {
this.future = future;
}
public KafkaFuture<Collection<TopicDescription>> value() {
return future;
}
}
|
...
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.
...