Versions Compared

Key

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

...

Code Block
languagejava
titleorg.apache.kafka.clients.admin
/**
 * Represents a list of Resource objects that have a hierarchical relationship.
 * For instance one could represent relationship like "clientA of user1".
 */
public class ResourceListpublic static class Quota {
    public QuotaType type();
    public double value();
    public QuotaSource source();
}

public static enum QuotaType {
    public ResourceList(String user, String clientPRDOUCER_BYTE_RATE(0), CONSUMER_BYTE_RATE(1), REQUEST_PERCENTAGE(2);

    public ResourceListQuotaType(ResourceType type, String resourceNamebyte id);
 
    /**
public byte id();
}

public static enum *QuotaSource Returns{
 the list of resources in a top to bottom (first to last) order.
     */SELF(0), DEFAULT(1), PARENT(2);
 
	QuotaSource(byte id);
 
    public List<Resource>byte resourcesid();
}
 
/**
 * ThisRepresents a classlist actsof asResource anobjects aliasthat forhave a hierarchical HashMaprelationship.
 that* mapsFor ainstance listone ofcould Resource
represent *relationship objectslike which"clientA representsof hierarchicaluser1".
 */
public class QuotaResourceMap extends HashMap<ResourceList, T> ResourceList {
    public QuotaResourceMapResourceList(ResourceListString keyuser, TString valueclient);
    public QuotaResourceMapResourceList(Map<ResourceListResourceType type, String T>resourceName);
}
 
public  class AdminClient {/**
     * publicReturns DescribeQuotasResult describeQuotas(QuotaResourceMap<Collection<QuotaType>>, DescribeQuotasOptions options);
    public AlterQuotasResult alterQuotas(QuotaResourceMap<Collection<Quota>> configs, AlterQuotasOptions options);
}
public class DescribeQuotasOptions { the list of resources in a top to bottom (first to last) order.
     */
    public DescribeQuotasOptionsList<Resource> timeoutMsresources(Integer timeout);
}

public 
/**
 * A helper class DescribeQuotasResult {
    public QuotaResourceMap<KafkaFuture<Collection<Quota>>> values();
}
  that makes sure that a given collection of Quota objects
 * are immutably stored and can be accessed.
public class AlterQuotasOptionsQuotaCollection { 
    public AlterQuotasOptions timeoutMsQuotaCollection(IntegerCollection<Quota> timeoutentries);
	
 
    public AlterQuotasOptionsCollection<Quota> validateOnlyentries(boolean validateOnly);
}

public class AlterQuotasResult {
    public QuotaResourceMap<KafkaFuture<Void>> results();
}

Request API

Code Block
languagejava
titleorg.apache.kafka.common.requests
public class QuotaList {
	public QuotaList(ApiError error, Collection<Quota> entries);

    public QuotaList(Collection<Quota> entries);

    public ApiError error( 
/**
 * This class acts as an alias for a HashMap that maps a list of Resource
 * objects which represents hierarchical
 *
public class QuotaResourceMap extends HashMap<ResourceList, T> {
    public QuotaResourceMap(ResourceList key, T value);
    public Collection<Quota> entries(QuotaResourceMap(Map<ResourceList, T>);
}
 
public static class QuotaAdminClient {
    public QuotaTypeDescribeQuotasResult type(describeQuotas(QuotaResourceMap<Collection<QuotaType>>, DescribeQuotasOptions options);
    public doubleAlterQuotasResult value(alterQuotas(QuotaResourceMap<QuotaCollection> configs, AlterQuotasOptions options);
}
public class DescribeQuotasOptions { 
    public QuotaSourceDescribeQuotasOptions sourcetimeoutMs(Integer timeout);
}

public staticclass enumDescribeQuotasResult QuotaType {
    PRDOUCER_BYTE_RATE(0), CONSUMER_BYTE_RATE(1), REQUEST_PERCENTAGE(2public QuotaResourceMap<KafkaFuture<QuotaCollection>> values();
	}
 
public class AlterQuotasOptions QuotaType(byte id);{ 
    
public AlterQuotasOptions   timeoutMs(Integer timeout);
	public byteAlterQuotasOptions idvalidateOnly(boolean validateOnly);
}

public staticclass enumAlterQuotasResult QuotaSource {
    public QuotaResourceMap<KafkaFuture<Void>> results();
}

Request API

Code Block
languagejava
titleorg.apache.kafka.common.requests
public class QuotaCollection {
	public QuotaCollection(ApiError error, Collection<Quota> entries);

    public QuotaCollection(Collection<Quota> entries);

    public ApiError error();SELF(0), DEFAULT(1), PARENT(2);
 
	QuotaSource(byte id);
 
    public byteCollection<Quota> identries();
}
 
public class DescribeQuotasRequest extends AbstractRequest {
	
	public static Schema[] schemaVersions();
	public static DescribeQuotasRequest parse(ByteBuffer buffer, short version);
 
	public static class Builder extends AbstractRequest.Builder {
		public Builder(Map<List<Resource>>,QuotaResourceMap<Collection<QuotaType>> Collection<QuotaType>> quotaSettings);
		public DescribeQuotasRequest build(short version);
	}
 
	public DescribeQuotasRequest(short version, Map<List<Resource>>, Collection<QuotaType>>QuotaResourceMap<Collection<QuotaType>> quotaSettings);
	public DescribeQuotasRequest(Struct struct, short version);
 
	public Map<List<Resource>>, Collection<QuotaType>> quotaSettingsQuotaResourceMap<Collection<QuotaType>> quotas();
}

public class DescribeQuotasResponse extends AbstractResponse {
	public static Schema[] schemaVersions();

	public DescribeQuotasResponse(int throttleTimeMs, Map<List<Resource>>, QuotaType> configsQuotaResourceMap<QuotaCollection> quotas);
	public DescribeQuotasResponse(Struct struct);

	public Map<List<Resource>>, DescribeConfigsResponse.Config> quotaConfigSettingsQuotaResourceMap<QuotaCollection> quotas();
}
 
public class AlterQuotasRequest extends AbstractRequest {
	public static Schema[] schemaVersions();
 
	public AlterQuotasRequest(short version, Map<List<Resource>>, AlterConfigsRequest.Config> configs, boolean validateOnly);
	public AlterQuotasRequest(Struct struct, static class Builder extends AbstractRequest.Builder {
		public Builder(QuotaResourceMap<QuotaCollection> quotaSettings);
		public DescribeQuotasRequest build(short version);
	}
 
	public AlterQuotasRequest(short Map<List<Resource>>version, DescribeConfigsResponse.Config> configs();
}

 

New Command Line Interface

The kafka-config.sh command line interface will change a little bit in terms of help message and response format as we will use argparse4j for parsing arguments.

Help Message

QuotaResourceMap<QuotaCollection> quotas, boolean validateOnly);
	public AlterQuotasRequest(Struct struct, short version);
 
	public QuotaResourceMap<QuotaCollection> quotas();
}
 
public class AlterQuotasResponse extends AbstractResponse {
	public static Schema[] schemaVersions();
 
	public AlterQuotasRequest(short version, QuotaResourceMap<ApiError> quotas, boolean validateOnly);
	public AlterQuotasRequest(Struct struct, short version);
 
	public QuotaResourceMap<ApiError> errors();
    public int throttleTimeMs();
}

 

New Command Line Interface

The kafka-config.sh command line interface will change a little bit in terms of help message and response format as we will use argparse4j for parsing arguments.

Help Message

No Format
usage: config-command [-h] --entity-type {topics,clients,users,brokers}
No Format
usage: config-command [-h] --entity-type {topics,clients,users,brokers}
                      [--force FORCE] [--add-config ADDCONFIG]
                      [--delete-configforce DELETECONFIGFORCE]
   [--add-config ADDCONFIG]
                      [--delete-config DELETECONFIG]
                      (--entity-name ENTITYNAME | --entity-default)
                      (--describe | --alter)
                      (--bootstrap-servers BOOTSTRAPSERVERS |
                      --config.properties CONFIGPROPERTIES)

Change configs for topics, clients, users, brokers dynamically.

optional arguments:
  -h, --help             show this help message and exit
  --entity-type {topics,clients,users,brokers}
                         REQUIRED:      the       type       of      entity
                         (topics/clients/users/brokers)
  --force FORCE          Suppresses console prompts
  --add-config ADDCONFIG
                         Key  Value  pairs  of   configs   to  add.  Square
                         brackets  can  be  used   to  group  values  which
                         contain commas: 'k1=v1,k2=[v1,v2,v2],k3=v3'.
  --delete-config DELETECONFIG
                         Config keys to remove in  the following form: 'k1,
                         k2'.

  You can specify only one in --entity-name and --entity-default

  --entity-name ENTITYNAME
                         Name of entity (client id/user principal name)
  --entity-default       Default entity name for  clients/users (applies to
                         corresponding entity type in command line)

  You can specify only one in --alter, --describe

  --describe             List  configs  for  the  given  entity.  (default:
                         false)
  --alter                Alter the configuration for  the entity. (default:
                         false)

  You can specify only one in --bootstrap-servers, --config.properties

  --bootstrap-servers BOOTSTRAPSERVERS
                         REQUIRED: The  broker  list  string  in  the  form
                         HOST1:PORT1,HOST2:PORT2.
  --config.properties CONFIGPROPERTIES
                         REQUIRED:  The  config  properties  file  for  the
                         Admin Client.

Process finished with exit code 0

...

Compatibility, Deprecation, And Migration Plan

Compatibility

The behavior of the --zookeeper command line parameter will change. After this change it will print a warning message saying its ignored. Therefore every user will need to change --zookeeper to --bootstrap-servers.

Firstly, behavior of the --zookeeper command line parameter will change. After this change it will print a warning message saying its ignored. Therefore every user will need to change --zookeeper to --bootstrap-servers

Secondly, users as of this KIP would be able to describe all topics or brokers in one step but can't do it for clients and users. For those who have this use case will still need to use the old command for a while (see below). The reason for this change is currently MetadataRequest provides enough information about topics and brokers so it's possible to describe all of them in one step but there's no such information about clients and users.

Finally, backward compatibilty (for instance a Also backward compatibilty (saying an 1.1 client wants to admin a 1.0 server) will be impacted as some of the protocols are newly created and doesn't exist in old servers. In these cases users should continue using the scala version of the ConfigCommand by putting the core jar on their classpath and defining the USE_OLD_COMMAND=true environment variable. This variable will set the main class to the old command in the config and invokes that. This way the environment variable ensures that users who aren't able to use the new command currently would need to make minimal changes in order to continue using it. 

...