Versions Compared

Key

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

...

Code Block
@InterfaceStability.Evolving
public class DescribeConfigsOptions extends AbstractOptions<DescribeConfigsOptions> {

    private boolean includeSynonyms = false;
    private boolean includeDocumentation = false;
    private List<String> configurationKeys = null;   // This is the newly introduced field
...
...
    public List<String> configurationKeys() {
      return configurationKeys;
    }
...
...
    public void configurationKeys(List<String> configurationKeys) {
      this.configurationKeys = configurationKeys;
    }
...
}

...

  1. Allow --config  option to be specified when using --describe option.  When used in such a way, only the configuration(s) specified will be fetched for the topic.
  2. Add --partition-only option that when used with –describe  will skip fetching configuration of the topics and will only return partition information.

Proposed Changes

...

Previous section lists the most of the changes that are needed. On the implementation side, when we convert DescribeConfigsOptions argument to Kafka apis DescribeConfigsResource object, we will fetch the list of configuration keys from the DescribeConfigsOptions and put that in the DescribeConfigsResource, so the new code will look like this:

Code Block
.map(config ->
    new DescribeConfigsRequestData.DescribeConfigsResource()
        .setResourceName(config.name())
        .setResourceType(config.type().id())
        .setConfigurationKeys(options.configurationKeys()))  // This is the change, instead of passing `null` we will pass the keys specified by user


Couple of things to note here:

  1. A user can specify a configuration key that isn't valid for the resource type specified. In this case the response will be empty and no configuration will be returned. This matches current behavior of DescribeConfigsRequest Kafka Api. In that sense AdminClient will just reflect the existing behavior of underlying Kafka api and will not be modifying it.
  2. A user can specify a mix of resource types as first argument to AdminClient::describeConfigs api, i.e. the resources  argument can contain a resource of BROKER  type and also a resource of TOPIC  type. When fetching all configurations this behavior has no significance. However when user specifies configurations to fetch, then unless somehow the configuration key happen to exist for all specified resources, all except one of the resource will have empty configurations returned. In that sense this new feature is mostly useful when clients of AdminClient::describeConfigs are fetching configuration for resource of only one type.

Compatibility, Deprecation, and Migration Plan

...