Interface Admin
- All Superinterfaces:
org.apache.kafka.clients.admin.Admin
,AutoCloseable
- All Known Implementing Classes:
AdminClient
,KafkaAdminClient
Instances returned from the create
methods of this interface are guaranteed to be thread safe.
However, the KafkaFutures
returned from request methods are executed
by a single thread so it is important that any code which executes on that thread when they complete
(using KafkaFuture.thenApply(KafkaFuture.Function)
, for example) doesn't block
for too long. If necessary, processing of results should be passed to another thread.
The operations exposed by Admin follow a consistent pattern:
- Admin instances should be created using
create(Properties)
orcreate(Map)
- Each operation typically has two overloaded methods, one which uses a default set of options and an overloaded method where the last parameter is an explicit options object.
- The operation method's first parameter is a
Collection
of items to perform the operation on. Batching multiple requests into a single call is more efficient and should be preferred over multiple calls to the same method. - The operation methods execute asynchronously.
- Each
xxx
operation method returns anXxxResult
class with methods which exposeKafkaFuture
for accessing the result(s) of the operation. - Typically an
all()
method is provided for getting the overall success/failure of the batch and avalues()
method provided access to each item in a request batch. Other methods may also be provided. - For synchronous behaviour use
KafkaFuture.get()
Here is a simple example of using an Admin client instance to create a new topic:
Properties props = new Properties();
props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
try (Admin admin = Admin.create(props)) {
String topicName = "my-topic";
int partitions = 12;
short replicationFactor = 3;
// Create a compacted topic
CreateTopicsResult result = admin.createTopics(Collections.singleton(
new NewTopic(topicName, partitions, replicationFactor)
.configs(Collections.singletonMap(TopicConfig.CLEANUP_POLICY_CONFIG, TopicConfig.CLEANUP_POLICY_COMPACT)));
// Call values() to get the result for a specific topic
KafkaFuture<Void> future = result.values().get(topicName);
// Call get() to block until the topic creation is complete or has failed
// if creation failed the ExecutionException wraps the underlying cause.
future.get();
}
Bootstrap and balancing
The bootstrap.servers
config in the Map
or Properties
passed
to create(Properties)
is only used for discovering the brokers in the cluster,
which the client will then connect to as needed.
As such, it is sufficient to include only two or three broker addresses to cope with the possibility of brokers
being unavailable.
Different operations necessitate requests being sent to different nodes in the cluster. For example
createTopics(Collection)
communicates with the controller, but describeTopics(Collection)
can talk to any broker. When the recipient does not matter the instance will try to use the broker with the
fewest outstanding requests.
The client will transparently retry certain errors which are usually transient.
For example if the request for createTopics()
get sent to a node which was not the controller
the metadata would be refreshed and the request re-sent to the controller.
-
Method Summary
Modifier and TypeMethodDescriptiondefault org.apache.kafka.clients.admin.AlterClientQuotasResult
alterClientQuotas
(Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries) Alters client quota configurations with the specified alterations.org.apache.kafka.clients.admin.AlterClientQuotasResult
alterClientQuotas
(Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries, org.apache.kafka.clients.admin.AlterClientQuotasOptions options) Alters client quota configurations with the specified alterations.default org.apache.kafka.clients.admin.AlterConfigsResult
alterConfigs
(Map<org.apache.kafka.common.config.ConfigResource, org.apache.kafka.clients.admin.Config> configs) Deprecated.Since 2.3.org.apache.kafka.clients.admin.AlterConfigsResult
alterConfigs
(Map<org.apache.kafka.common.config.ConfigResource, org.apache.kafka.clients.admin.Config> configs, org.apache.kafka.clients.admin.AlterConfigsOptions options) Deprecated.Since 2.3.default org.apache.kafka.clients.admin.AlterConsumerGroupOffsetsResult
alterConsumerGroupOffsets
(String groupId, Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets) Alters offsets for the specified group.org.apache.kafka.clients.admin.AlterConsumerGroupOffsetsResult
alterConsumerGroupOffsets
(String groupId, Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, org.apache.kafka.clients.admin.AlterConsumerGroupOffsetsOptions options) Alters offsets for the specified group.default org.apache.kafka.clients.admin.AlterPartitionReassignmentsResult
alterPartitionReassignments
(Map<org.apache.kafka.common.TopicPartition, Optional<org.apache.kafka.clients.admin.NewPartitionReassignment>> reassignments) Change the reassignments for one or more partitions.org.apache.kafka.clients.admin.AlterPartitionReassignmentsResult
alterPartitionReassignments
(Map<org.apache.kafka.common.TopicPartition, Optional<org.apache.kafka.clients.admin.NewPartitionReassignment>> reassignments, org.apache.kafka.clients.admin.AlterPartitionReassignmentsOptions options) Change the reassignments for one or more partitions.default org.apache.kafka.clients.admin.AlterReplicaLogDirsResult
alterReplicaLogDirs
(Map<org.apache.kafka.common.TopicPartitionReplica, String> replicaAssignment) Change the log directory for the specified replicas.org.apache.kafka.clients.admin.AlterReplicaLogDirsResult
alterReplicaLogDirs
(Map<org.apache.kafka.common.TopicPartitionReplica, String> replicaAssignment, org.apache.kafka.clients.admin.AlterReplicaLogDirsOptions options) Change the log directory for the specified replicas.default org.apache.kafka.clients.admin.AlterUserScramCredentialsResult
alterUserScramCredentials
(List<org.apache.kafka.clients.admin.UserScramCredentialAlteration> alterations) Alter SASL/SCRAM credentials for the given users.org.apache.kafka.clients.admin.AlterUserScramCredentialsResult
alterUserScramCredentials
(List<org.apache.kafka.clients.admin.UserScramCredentialAlteration> alterations, org.apache.kafka.clients.admin.AlterUserScramCredentialsOptions options) Alter SASL/SCRAM credentials.default void
close()
Close the Admin and release all associated resources.default void
Deprecated.Since 2.2.void
Close the Admin client and release all associated resources.static org.apache.kafka.clients.admin.Admin
Create a new Admin with the given configuration.static org.apache.kafka.clients.admin.Admin
create
(Properties props) Create a new Admin with the given configuration.default org.apache.kafka.clients.admin.CreateAclsResult
createAcls
(Collection<org.apache.kafka.common.acl.AclBinding> acls) This is a convenience method forcreateAcls(Collection, CreateAclsOptions)
with default options.org.apache.kafka.clients.admin.CreateAclsResult
createAcls
(Collection<org.apache.kafka.common.acl.AclBinding> acls, org.apache.kafka.clients.admin.CreateAclsOptions options) Creates access control lists (ACLs) which are bound to specific resources.default org.apache.kafka.clients.admin.CreateDelegationTokenResult
Create a Delegation Token.org.apache.kafka.clients.admin.CreateDelegationTokenResult
createDelegationToken
(org.apache.kafka.clients.admin.CreateDelegationTokenOptions options) Create a Delegation Token.default org.apache.kafka.clients.admin.CreatePartitionsResult
createPartitions
(Map<String, org.apache.kafka.clients.admin.NewPartitions> newPartitions) Increase the number of partitions of the topics given as the keys ofnewPartitions
according to the corresponding values.org.apache.kafka.clients.admin.CreatePartitionsResult
createPartitions
(Map<String, org.apache.kafka.clients.admin.NewPartitions> newPartitions, org.apache.kafka.clients.admin.CreatePartitionsOptions options) Increase the number of partitions of the topics given as the keys ofnewPartitions
according to the corresponding values.default org.apache.kafka.clients.admin.CreateTopicsResult
createTopics
(Collection<org.apache.kafka.clients.admin.NewTopic> newTopics) Create a batch of new topics with the default options.org.apache.kafka.clients.admin.CreateTopicsResult
createTopics
(Collection<org.apache.kafka.clients.admin.NewTopic> newTopics, org.apache.kafka.clients.admin.CreateTopicsOptions options) Create a batch of new topics.default org.apache.kafka.clients.admin.DeleteAclsResult
deleteAcls
(Collection<org.apache.kafka.common.acl.AclBindingFilter> filters) This is a convenience method fordeleteAcls(Collection, DeleteAclsOptions)
with default options.org.apache.kafka.clients.admin.DeleteAclsResult
deleteAcls
(Collection<org.apache.kafka.common.acl.AclBindingFilter> filters, org.apache.kafka.clients.admin.DeleteAclsOptions options) Deletes access control lists (ACLs) according to the supplied filters.default org.apache.kafka.clients.admin.DeleteConsumerGroupOffsetsResult
deleteConsumerGroupOffsets
(String groupId, Set<org.apache.kafka.common.TopicPartition> partitions) Delete committed offsets for a set of partitions in a consumer group with the default options.org.apache.kafka.clients.admin.DeleteConsumerGroupOffsetsResult
deleteConsumerGroupOffsets
(String groupId, Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.DeleteConsumerGroupOffsetsOptions options) Delete committed offsets for a set of partitions in a consumer group.default org.apache.kafka.clients.admin.DeleteConsumerGroupsResult
deleteConsumerGroups
(Collection<String> groupIds) Delete consumer groups from the cluster with the default options.org.apache.kafka.clients.admin.DeleteConsumerGroupsResult
deleteConsumerGroups
(Collection<String> groupIds, org.apache.kafka.clients.admin.DeleteConsumerGroupsOptions options) Delete consumer groups from the cluster.default org.apache.kafka.clients.admin.DeleteRecordsResult
deleteRecords
(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.RecordsToDelete> recordsToDelete) Delete records whose offset is smaller than the given offset of the corresponding partition.org.apache.kafka.clients.admin.DeleteRecordsResult
deleteRecords
(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.RecordsToDelete> recordsToDelete, org.apache.kafka.clients.admin.DeleteRecordsOptions options) Delete records whose offset is smaller than the given offset of the corresponding partition.default org.apache.kafka.clients.admin.DeleteTopicsResult
deleteTopics
(Collection<String> topics) This is a convenience method fordeleteTopics(Collection, DeleteTopicsOptions)
with default options.org.apache.kafka.clients.admin.DeleteTopicsResult
deleteTopics
(Collection<String> topics, org.apache.kafka.clients.admin.DeleteTopicsOptions options) Delete a batch of topics.default org.apache.kafka.clients.admin.DescribeAclsResult
describeAcls
(org.apache.kafka.common.acl.AclBindingFilter filter) This is a convenience method fordescribeAcls(AclBindingFilter, DescribeAclsOptions)
with default options.org.apache.kafka.clients.admin.DescribeAclsResult
describeAcls
(org.apache.kafka.common.acl.AclBindingFilter filter, org.apache.kafka.clients.admin.DescribeAclsOptions options) Lists access control lists (ACLs) according to the supplied filter.default org.apache.kafka.clients.admin.DescribeClientQuotasResult
describeClientQuotas
(org.apache.kafka.common.quota.ClientQuotaFilter filter) Describes all entities matching the provided filter that have at least one client quota configuration value defined.org.apache.kafka.clients.admin.DescribeClientQuotasResult
describeClientQuotas
(org.apache.kafka.common.quota.ClientQuotaFilter filter, org.apache.kafka.clients.admin.DescribeClientQuotasOptions options) Describes all entities matching the provided filter that have at least one client quota configuration value defined.default org.apache.kafka.clients.admin.DescribeClusterResult
Get information about the nodes in the cluster, using the default options.org.apache.kafka.clients.admin.DescribeClusterResult
describeCluster
(org.apache.kafka.clients.admin.DescribeClusterOptions options) Get information about the nodes in the cluster.default org.apache.kafka.clients.admin.DescribeConfigsResult
describeConfigs
(Collection<org.apache.kafka.common.config.ConfigResource> resources) Get the configuration for the specified resources with the default options.org.apache.kafka.clients.admin.DescribeConfigsResult
describeConfigs
(Collection<org.apache.kafka.common.config.ConfigResource> resources, org.apache.kafka.clients.admin.DescribeConfigsOptions options) Get the configuration for the specified resources.default org.apache.kafka.clients.admin.DescribeConsumerGroupsResult
describeConsumerGroups
(Collection<String> groupIds) Describe some group IDs in the cluster, with the default options.org.apache.kafka.clients.admin.DescribeConsumerGroupsResult
describeConsumerGroups
(Collection<String> groupIds, org.apache.kafka.clients.admin.DescribeConsumerGroupsOptions options) Describe some group IDs in the cluster.default org.apache.kafka.clients.admin.DescribeDelegationTokenResult
Describe the Delegation Tokens.org.apache.kafka.clients.admin.DescribeDelegationTokenResult
describeDelegationToken
(org.apache.kafka.clients.admin.DescribeDelegationTokenOptions options) Describe the Delegation Tokens.default org.apache.kafka.clients.admin.DescribeFeaturesResult
Describes finalized as well as supported features.org.apache.kafka.clients.admin.DescribeFeaturesResult
describeFeatures
(org.apache.kafka.clients.admin.DescribeFeaturesOptions options) Describes finalized as well as supported features.default org.apache.kafka.clients.admin.DescribeLogDirsResult
describeLogDirs
(Collection<Integer> brokers) Query the information of all log directories on the given set of brokersorg.apache.kafka.clients.admin.DescribeLogDirsResult
describeLogDirs
(Collection<Integer> brokers, org.apache.kafka.clients.admin.DescribeLogDirsOptions options) Query the information of all log directories on the given set of brokersdefault org.apache.kafka.clients.admin.DescribeReplicaLogDirsResult
describeReplicaLogDirs
(Collection<org.apache.kafka.common.TopicPartitionReplica> replicas) Query the replica log directory information for the specified replicas.org.apache.kafka.clients.admin.DescribeReplicaLogDirsResult
describeReplicaLogDirs
(Collection<org.apache.kafka.common.TopicPartitionReplica> replicas, org.apache.kafka.clients.admin.DescribeReplicaLogDirsOptions options) Query the replica log directory information for the specified replicas.default org.apache.kafka.clients.admin.DescribeTopicsResult
describeTopics
(Collection<String> topicNames) Describe some topics in the cluster, with the default options.org.apache.kafka.clients.admin.DescribeTopicsResult
describeTopics
(Collection<String> topicNames, org.apache.kafka.clients.admin.DescribeTopicsOptions options) Describe some topics in the cluster.default org.apache.kafka.clients.admin.DescribeUserScramCredentialsResult
Describe all SASL/SCRAM credentials.default org.apache.kafka.clients.admin.DescribeUserScramCredentialsResult
describeUserScramCredentials
(List<String> users) Describe SASL/SCRAM credentials for the given users.org.apache.kafka.clients.admin.DescribeUserScramCredentialsResult
describeUserScramCredentials
(List<String> users, org.apache.kafka.clients.admin.DescribeUserScramCredentialsOptions options) Describe SASL/SCRAM credentials.default org.apache.kafka.clients.admin.ElectLeadersResult
electLeaders
(org.apache.kafka.common.ElectionType electionType, Set<org.apache.kafka.common.TopicPartition> partitions) Elect a replica as leader for topic partitions.org.apache.kafka.clients.admin.ElectLeadersResult
electLeaders
(org.apache.kafka.common.ElectionType electionType, Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.ElectLeadersOptions options) Elect a replica as leader for the givenpartitions
, or for all partitions if the argument topartitions
is null.default org.apache.kafka.clients.admin.ElectLeadersResult
electPreferredLeaders
(Collection<org.apache.kafka.common.TopicPartition> partitions) Deprecated.Since 2.4.0.default org.apache.kafka.clients.admin.ElectLeadersResult
electPreferredLeaders
(Collection<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.ElectLeadersOptions options) Deprecated.Since 2.4.0.default org.apache.kafka.clients.admin.ExpireDelegationTokenResult
expireDelegationToken
(byte[] hmac) Expire a Delegation Token.org.apache.kafka.clients.admin.ExpireDelegationTokenResult
expireDelegationToken
(byte[] hmac, org.apache.kafka.clients.admin.ExpireDelegationTokenOptions options) Expire a Delegation Token.default org.apache.kafka.clients.admin.AlterConfigsResult
incrementalAlterConfigs
(Map<org.apache.kafka.common.config.ConfigResource, Collection<org.apache.kafka.clients.admin.AlterConfigOp>> configs) Incrementally updates the configuration for the specified resources with default options.org.apache.kafka.clients.admin.AlterConfigsResult
incrementalAlterConfigs
(Map<org.apache.kafka.common.config.ConfigResource, Collection<org.apache.kafka.clients.admin.AlterConfigOp>> configs, org.apache.kafka.clients.admin.AlterConfigsOptions options) Incrementally update the configuration for the specified resources.default org.apache.kafka.clients.admin.ListConsumerGroupOffsetsResult
listConsumerGroupOffsets
(String groupId) List the consumer group offsets available in the cluster with the default options.org.apache.kafka.clients.admin.ListConsumerGroupOffsetsResult
listConsumerGroupOffsets
(String groupId, org.apache.kafka.clients.admin.ListConsumerGroupOffsetsOptions options) List the consumer group offsets available in the cluster.default org.apache.kafka.clients.admin.ListConsumerGroupsResult
List the consumer groups available in the cluster with the default options.org.apache.kafka.clients.admin.ListConsumerGroupsResult
listConsumerGroups
(org.apache.kafka.clients.admin.ListConsumerGroupsOptions options) List the consumer groups available in the cluster.default org.apache.kafka.clients.admin.ListOffsetsResult
listOffsets
(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.OffsetSpec> topicPartitionOffsets) List offset for the specified partitions and OffsetSpec.org.apache.kafka.clients.admin.ListOffsetsResult
listOffsets
(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.OffsetSpec> topicPartitionOffsets, org.apache.kafka.clients.admin.ListOffsetsOptions options) List offset for the specified partitions.default org.apache.kafka.clients.admin.ListPartitionReassignmentsResult
List all of the current partition reassignments This is a convenience method forlistPartitionReassignments(ListPartitionReassignmentsOptions)
with default options.org.apache.kafka.clients.admin.ListPartitionReassignmentsResult
listPartitionReassignments
(Optional<Set<org.apache.kafka.common.TopicPartition>> partitions, org.apache.kafka.clients.admin.ListPartitionReassignmentsOptions options) default org.apache.kafka.clients.admin.ListPartitionReassignmentsResult
listPartitionReassignments
(Set<org.apache.kafka.common.TopicPartition> partitions) List the current reassignments for the given partitions This is a convenience method forlistPartitionReassignments(Set, ListPartitionReassignmentsOptions)
with default options.default org.apache.kafka.clients.admin.ListPartitionReassignmentsResult
listPartitionReassignments
(Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.ListPartitionReassignmentsOptions options) List the current reassignments for the given partitionsdefault org.apache.kafka.clients.admin.ListPartitionReassignmentsResult
listPartitionReassignments
(org.apache.kafka.clients.admin.ListPartitionReassignmentsOptions options) List all of the current partition reassignmentsdefault org.apache.kafka.clients.admin.ListTopicsResult
List the topics available in the cluster with the default options.org.apache.kafka.clients.admin.ListTopicsResult
listTopics
(org.apache.kafka.clients.admin.ListTopicsOptions options) List the topics available in the cluster.Map<org.apache.kafka.common.MetricName,
? extends org.apache.kafka.common.Metric> metrics()
Get the metrics kept by the adminClientorg.apache.kafka.clients.admin.RemoveMembersFromConsumerGroupResult
removeMembersFromConsumerGroup
(String groupId, org.apache.kafka.clients.admin.RemoveMembersFromConsumerGroupOptions options) Remove members from the consumer group by given member identities.default org.apache.kafka.clients.admin.RenewDelegationTokenResult
renewDelegationToken
(byte[] hmac) Renew a Delegation Token.org.apache.kafka.clients.admin.RenewDelegationTokenResult
renewDelegationToken
(byte[] hmac, org.apache.kafka.clients.admin.RenewDelegationTokenOptions options) Renew a Delegation Token.default org.apache.kafka.clients.admin.UnregisterBrokerResult
unregisterBroker
(int brokerId) Unregister a broker.org.apache.kafka.clients.admin.UnregisterBrokerResult
unregisterBroker
(int brokerId, org.apache.kafka.clients.admin.UnregisterBrokerOptions options) Unregister a broker.org.apache.kafka.clients.admin.UpdateFeaturesResult
updateFeatures
(Map<String, org.apache.kafka.clients.admin.FeatureUpdate> featureUpdates, org.apache.kafka.clients.admin.UpdateFeaturesOptions options) Applies specified updates to finalized features.Methods inherited from interface org.apache.kafka.clients.admin.Admin
abortTransaction, abortTransaction, clientInstanceId, deleteTopics, deleteTopics, describeMetadataQuorum, describeMetadataQuorum, describeProducers, describeProducers, describeTopics, describeTopics, describeTransactions, describeTransactions, fenceProducers, fenceProducers, listClientMetricsResources, listClientMetricsResources, listConsumerGroupOffsets, listConsumerGroupOffsets, listTransactions, listTransactions
-
Method Details
-
create
Create a new Admin with the given configuration.- Parameters:
props
- The configuration.- Returns:
- The new KafkaAdminClient.
-
create
Create a new Admin with the given configuration.- Parameters:
conf
- The configuration.- Returns:
- The new KafkaAdminClient.
-
close
default void close()Close the Admin and release all associated resources.- Specified by:
close
in interfaceorg.apache.kafka.clients.admin.Admin
- Specified by:
close
in interfaceAutoCloseable
-
close
Deprecated.Since 2.2. Useclose(Duration)
orclose()
.Close the Admin and release all associated resources.The close operation has a grace period during which current operations will be allowed to complete, specified by the given duration and time unit. New operations will not be accepted during the grace period. Once the grace period is over, all operations that have not yet been completed will be aborted with a
TimeoutException
.- Parameters:
duration
- The duration to use for the wait time.unit
- The time unit to use for the wait time.
-
close
Close the Admin client and release all associated resources.The close operation has a grace period during which current operations will be allowed to complete, specified by the given duration. New operations will not be accepted during the grace period. Once the grace period is over, all operations that have not yet been completed will be aborted with a
TimeoutException
.- Specified by:
close
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
timeout
- The time to use for the wait time.
-
createTopics
default org.apache.kafka.clients.admin.CreateTopicsResult createTopics(Collection<org.apache.kafka.clients.admin.NewTopic> newTopics) Create a batch of new topics with the default options.This is a convenience method for
createTopics(Collection, CreateTopicsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.10.1.0 or higher.
- Specified by:
createTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
newTopics
- The new topics to create.- Returns:
- The CreateTopicsResult.
-
createTopics
org.apache.kafka.clients.admin.CreateTopicsResult createTopics(Collection<org.apache.kafka.clients.admin.NewTopic> newTopics, org.apache.kafka.clients.admin.CreateTopicsOptions options) Create a batch of new topics.This operation is not transactional so it may succeed for some topics while fail for others.
It may take several seconds after
CreateTopicsResult
returns success for all the brokers to become aware that the topics have been created. During this time,listTopics()
anddescribeTopics(Collection)
may not return information about the new topics.This operation is supported by brokers with version 0.10.1.0 or higher. The validateOnly option is supported from version 0.10.2.0.
- Specified by:
createTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
newTopics
- The new topics to create.options
- The options to use when creating the new topics.- Returns:
- The CreateTopicsResult.
-
deleteTopics
This is a convenience method fordeleteTopics(Collection, DeleteTopicsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.10.1.0 or higher.
- Specified by:
deleteTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
topics
- The topic names to delete.- Returns:
- The DeleteTopicsResult.
-
deleteTopics
org.apache.kafka.clients.admin.DeleteTopicsResult deleteTopics(Collection<String> topics, org.apache.kafka.clients.admin.DeleteTopicsOptions options) Delete a batch of topics.This operation is not transactional so it may succeed for some topics while fail for others.
It may take several seconds after the
DeleteTopicsResult
returns success for all the brokers to become aware that the topics are gone. During this time,listTopics()
anddescribeTopics(Collection)
may continue to return information about the deleted topics.If delete.topic.enable is false on the brokers, deleteTopics will mark the topics for deletion, but not actually delete them. The futures will return successfully in this case.
This operation is supported by brokers with version 0.10.1.0 or higher.
- Specified by:
deleteTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
topics
- The topic names to delete.options
- The options to use when deleting the topics.- Returns:
- The DeleteTopicsResult.
-
listTopics
default org.apache.kafka.clients.admin.ListTopicsResult listTopics()List the topics available in the cluster with the default options.This is a convenience method for
listTopics(ListTopicsOptions)
with default options. See the overload for more details.- Specified by:
listTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The ListTopicsResult.
-
listTopics
org.apache.kafka.clients.admin.ListTopicsResult listTopics(org.apache.kafka.clients.admin.ListTopicsOptions options) List the topics available in the cluster.- Specified by:
listTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when listing the topics.- Returns:
- The ListTopicsResult.
-
describeTopics
default org.apache.kafka.clients.admin.DescribeTopicsResult describeTopics(Collection<String> topicNames) Describe some topics in the cluster, with the default options.This is a convenience method for
describeTopics(Collection, DescribeTopicsOptions)
with default options. See the overload for more details.- Specified by:
describeTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
topicNames
- The names of the topics to describe.- Returns:
- The DescribeTopicsResult.
-
describeTopics
org.apache.kafka.clients.admin.DescribeTopicsResult describeTopics(Collection<String> topicNames, org.apache.kafka.clients.admin.DescribeTopicsOptions options) Describe some topics in the cluster.- Specified by:
describeTopics
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
topicNames
- The names of the topics to describe.options
- The options to use when describing the topic.- Returns:
- The DescribeTopicsResult.
-
describeCluster
default org.apache.kafka.clients.admin.DescribeClusterResult describeCluster()Get information about the nodes in the cluster, using the default options.This is a convenience method for
describeCluster(DescribeClusterOptions)
with default options. See the overload for more details.- Specified by:
describeCluster
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The DescribeClusterResult.
-
describeCluster
org.apache.kafka.clients.admin.DescribeClusterResult describeCluster(org.apache.kafka.clients.admin.DescribeClusterOptions options) Get information about the nodes in the cluster.- Specified by:
describeCluster
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when getting information about the cluster.- Returns:
- The DescribeClusterResult.
-
describeAcls
default org.apache.kafka.clients.admin.DescribeAclsResult describeAcls(org.apache.kafka.common.acl.AclBindingFilter filter) This is a convenience method fordescribeAcls(AclBindingFilter, DescribeAclsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
describeAcls
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
filter
- The filter to use.- Returns:
- The DeleteAclsResult.
-
describeAcls
org.apache.kafka.clients.admin.DescribeAclsResult describeAcls(org.apache.kafka.common.acl.AclBindingFilter filter, org.apache.kafka.clients.admin.DescribeAclsOptions options) Lists access control lists (ACLs) according to the supplied filter.Note: it may take some time for changes made by
createAcls
ordeleteAcls
to be reflected in the output ofdescribeAcls
.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
describeAcls
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
filter
- The filter to use.options
- The options to use when listing the ACLs.- Returns:
- The DeleteAclsResult.
-
createAcls
default org.apache.kafka.clients.admin.CreateAclsResult createAcls(Collection<org.apache.kafka.common.acl.AclBinding> acls) This is a convenience method forcreateAcls(Collection, CreateAclsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
createAcls
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
acls
- The ACLs to create- Returns:
- The CreateAclsResult.
-
createAcls
org.apache.kafka.clients.admin.CreateAclsResult createAcls(Collection<org.apache.kafka.common.acl.AclBinding> acls, org.apache.kafka.clients.admin.CreateAclsOptions options) Creates access control lists (ACLs) which are bound to specific resources.This operation is not transactional so it may succeed for some ACLs while fail for others.
If you attempt to add an ACL that duplicates an existing ACL, no error will be raised, but no changes will be made.
This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
createAcls
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
acls
- The ACLs to createoptions
- The options to use when creating the ACLs.- Returns:
- The CreateAclsResult.
-
deleteAcls
default org.apache.kafka.clients.admin.DeleteAclsResult deleteAcls(Collection<org.apache.kafka.common.acl.AclBindingFilter> filters) This is a convenience method fordeleteAcls(Collection, DeleteAclsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
deleteAcls
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
filters
- The filters to use.- Returns:
- The DeleteAclsResult.
-
deleteAcls
org.apache.kafka.clients.admin.DeleteAclsResult deleteAcls(Collection<org.apache.kafka.common.acl.AclBindingFilter> filters, org.apache.kafka.clients.admin.DeleteAclsOptions options) Deletes access control lists (ACLs) according to the supplied filters.This operation is not transactional so it may succeed for some ACLs while fail for others.
This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
deleteAcls
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
filters
- The filters to use.options
- The options to use when deleting the ACLs.- Returns:
- The DeleteAclsResult.
-
describeConfigs
default org.apache.kafka.clients.admin.DescribeConfigsResult describeConfigs(Collection<org.apache.kafka.common.config.ConfigResource> resources) Get the configuration for the specified resources with the default options.This is a convenience method for
describeConfigs(Collection, DescribeConfigsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
describeConfigs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
resources
- The resources (topic and broker resource types are currently supported)- Returns:
- The DescribeConfigsResult
-
describeConfigs
org.apache.kafka.clients.admin.DescribeConfigsResult describeConfigs(Collection<org.apache.kafka.common.config.ConfigResource> resources, org.apache.kafka.clients.admin.DescribeConfigsOptions options) Get the configuration for the specified resources.The returned configuration includes default values and the isDefault() method can be used to distinguish them from user supplied values.
The value of config entries where isSensitive() is true is always
null
so that sensitive information is not disclosed.Config entries where isReadOnly() is true cannot be updated.
This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
describeConfigs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
resources
- The resources (topic and broker resource types are currently supported)options
- The options to use when describing configs- Returns:
- The DescribeConfigsResult
-
alterConfigs
@Deprecated default org.apache.kafka.clients.admin.AlterConfigsResult alterConfigs(Map<org.apache.kafka.common.config.ConfigResource, org.apache.kafka.clients.admin.Config> configs) Deprecated.Since 2.3. UseincrementalAlterConfigs(Map)
.Update the configuration for the specified resources with the default options.This is a convenience method for
alterConfigs(Map, AlterConfigsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
alterConfigs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
configs
- The resources with their configs (topic is the only resource type with configs that can be updated currently)- Returns:
- The AlterConfigsResult
-
alterConfigs
@Deprecated org.apache.kafka.clients.admin.AlterConfigsResult alterConfigs(Map<org.apache.kafka.common.config.ConfigResource, org.apache.kafka.clients.admin.Config> configs, org.apache.kafka.clients.admin.AlterConfigsOptions options) Deprecated.Since 2.3. UseincrementalAlterConfigs(Map, AlterConfigsOptions)
.Update the configuration for the specified resources with the default options.Updates are not transactional so they may succeed for some resources while fail for others. The configs for a particular resource are updated atomically.
This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
alterConfigs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
configs
- The resources with their configs (topic is the only resource type with configs that can be updated currently)options
- The options to use when describing configs- Returns:
- The AlterConfigsResult
-
incrementalAlterConfigs
default org.apache.kafka.clients.admin.AlterConfigsResult incrementalAlterConfigs(Map<org.apache.kafka.common.config.ConfigResource, Collection<org.apache.kafka.clients.admin.AlterConfigOp>> configs) Incrementally updates the configuration for the specified resources with default options.This is a convenience method for
incrementalAlterConfigs(Map, AlterConfigsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 2.3.0 or higher.
- Specified by:
incrementalAlterConfigs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
configs
- The resources with their configs- Returns:
- The AlterConfigsResult
-
incrementalAlterConfigs
org.apache.kafka.clients.admin.AlterConfigsResult incrementalAlterConfigs(Map<org.apache.kafka.common.config.ConfigResource, Collection<org.apache.kafka.clients.admin.AlterConfigOp>> configs, org.apache.kafka.clients.admin.AlterConfigsOptions options) Incrementally update the configuration for the specified resources.Updates are not transactional so they may succeed for some resources while fail for others. The configs for a particular resource are updated atomically.
The following exceptions can be anticipated when calling
get()
on the futures obtained from the returnedAlterConfigsResult
:ClusterAuthorizationException
if the authenticated user didn't have alter access to the cluster.TopicAuthorizationException
if the authenticated user didn't have alter access to the Topic.UnknownTopicOrPartitionException
if the Topic doesn't exist.InvalidRequestException
if the request details are invalid. e.g., a configuration key was specified more than once for a resource
This operation is supported by brokers with version 2.3.0 or higher.
- Specified by:
incrementalAlterConfigs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
configs
- The resources with their configsoptions
- The options to use when altering configs- Returns:
- The AlterConfigsResult
-
alterReplicaLogDirs
default org.apache.kafka.clients.admin.AlterReplicaLogDirsResult alterReplicaLogDirs(Map<org.apache.kafka.common.TopicPartitionReplica, String> replicaAssignment) Change the log directory for the specified replicas. If the replica does not exist on the broker, the result shows REPLICA_NOT_AVAILABLE for the given replica and the replica will be created in the given log directory on the broker when it is created later. If the replica already exists on the broker, the replica will be moved to the given log directory if it is not already there. For detailed result, inspect the returnedAlterReplicaLogDirsResult
instance.This operation is not transactional so it may succeed for some replicas while fail for others.
This is a convenience method for
alterReplicaLogDirs(Map, AlterReplicaLogDirsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 1.1.0 or higher.
- Specified by:
alterReplicaLogDirs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
replicaAssignment
- The replicas with their log directory absolute path- Returns:
- The AlterReplicaLogDirsResult
-
alterReplicaLogDirs
org.apache.kafka.clients.admin.AlterReplicaLogDirsResult alterReplicaLogDirs(Map<org.apache.kafka.common.TopicPartitionReplica, String> replicaAssignment, org.apache.kafka.clients.admin.AlterReplicaLogDirsOptions options) Change the log directory for the specified replicas. If the replica does not exist on the broker, the result shows REPLICA_NOT_AVAILABLE for the given replica and the replica will be created in the given log directory on the broker when it is created later. If the replica already exists on the broker, the replica will be moved to the given log directory if it is not already there. For detailed result, inspect the returnedAlterReplicaLogDirsResult
instance.This operation is not transactional so it may succeed for some replicas while fail for others.
This operation is supported by brokers with version 1.1.0 or higher.
- Specified by:
alterReplicaLogDirs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
replicaAssignment
- The replicas with their log directory absolute pathoptions
- The options to use when changing replica dir- Returns:
- The AlterReplicaLogDirsResult
-
describeLogDirs
default org.apache.kafka.clients.admin.DescribeLogDirsResult describeLogDirs(Collection<Integer> brokers) Query the information of all log directories on the given set of brokersThis is a convenience method for
describeLogDirs(Collection, DescribeLogDirsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 1.0.0 or higher.
- Specified by:
describeLogDirs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
brokers
- A list of brokers- Returns:
- The DescribeLogDirsResult
-
describeLogDirs
org.apache.kafka.clients.admin.DescribeLogDirsResult describeLogDirs(Collection<Integer> brokers, org.apache.kafka.clients.admin.DescribeLogDirsOptions options) Query the information of all log directories on the given set of brokersThis operation is supported by brokers with version 1.0.0 or higher.
- Specified by:
describeLogDirs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
brokers
- A list of brokersoptions
- The options to use when querying log dir info- Returns:
- The DescribeLogDirsResult
-
describeReplicaLogDirs
default org.apache.kafka.clients.admin.DescribeReplicaLogDirsResult describeReplicaLogDirs(Collection<org.apache.kafka.common.TopicPartitionReplica> replicas) Query the replica log directory information for the specified replicas.This is a convenience method for
describeReplicaLogDirs(Collection, DescribeReplicaLogDirsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 1.0.0 or higher.
- Specified by:
describeReplicaLogDirs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
replicas
- The replicas to query- Returns:
- The DescribeReplicaLogDirsResult
-
describeReplicaLogDirs
org.apache.kafka.clients.admin.DescribeReplicaLogDirsResult describeReplicaLogDirs(Collection<org.apache.kafka.common.TopicPartitionReplica> replicas, org.apache.kafka.clients.admin.DescribeReplicaLogDirsOptions options) Query the replica log directory information for the specified replicas.This operation is supported by brokers with version 1.0.0 or higher.
- Specified by:
describeReplicaLogDirs
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
replicas
- The replicas to queryoptions
- The options to use when querying replica log dir info- Returns:
- The DescribeReplicaLogDirsResult
-
createPartitions
default org.apache.kafka.clients.admin.CreatePartitionsResult createPartitions(Map<String, org.apache.kafka.clients.admin.NewPartitions> newPartitions) Increase the number of partitions of the topics given as the keys ofnewPartitions
according to the corresponding values. If partitions are increased for a topic that has a key, the partition logic or ordering of the messages will be affected.This is a convenience method for
createPartitions(Map, CreatePartitionsOptions)
with default options. See the overload for more details.- Specified by:
createPartitions
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
newPartitions
- The topics which should have new partitions created, and corresponding parameters for the created partitions.- Returns:
- The CreatePartitionsResult.
-
createPartitions
org.apache.kafka.clients.admin.CreatePartitionsResult createPartitions(Map<String, org.apache.kafka.clients.admin.NewPartitions> newPartitions, org.apache.kafka.clients.admin.CreatePartitionsOptions options) Increase the number of partitions of the topics given as the keys ofnewPartitions
according to the corresponding values. If partitions are increased for a topic that has a key, the partition logic or ordering of the messages will be affected.This operation is not transactional so it may succeed for some topics while fail for others.
It may take several seconds after this method returns success for all the brokers to become aware that the partitions have been created. During this time,
describeTopics(Collection)
may not return information about the new partitions.This operation is supported by brokers with version 1.0.0 or higher.
The following exceptions can be anticipated when calling
get()
on the futures obtained from thevalues()
method of the returnedCreatePartitionsResult
AuthorizationException
if the authenticated user is not authorized to alter the topicTimeoutException
if the request was not completed in within the givenAbstractOptions.timeoutMs()
.ReassignmentInProgressException
if a partition reassignment is currently in progressBrokerNotAvailableException
if the requestedNewPartitions.assignments()
contain a broker that is currently unavailable.InvalidReplicationFactorException
if noNewPartitions.assignments()
are given and it is impossible for the broker to assign replicas with the topics replication factor.- Subclasses of
KafkaException
if the request is invalid in some way.
- Specified by:
createPartitions
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
newPartitions
- The topics which should have new partitions created, and corresponding parameters for the created partitions.options
- The options to use when creating the new partitions.- Returns:
- The CreatePartitionsResult.
-
deleteRecords
default org.apache.kafka.clients.admin.DeleteRecordsResult deleteRecords(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.RecordsToDelete> recordsToDelete) Delete records whose offset is smaller than the given offset of the corresponding partition.This is a convenience method for
deleteRecords(Map, DeleteRecordsOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
deleteRecords
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
recordsToDelete
- The topic partitions and related offsets from which records deletion starts.- Returns:
- The DeleteRecordsResult.
-
deleteRecords
org.apache.kafka.clients.admin.DeleteRecordsResult deleteRecords(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.RecordsToDelete> recordsToDelete, org.apache.kafka.clients.admin.DeleteRecordsOptions options) Delete records whose offset is smaller than the given offset of the corresponding partition.This operation is supported by brokers with version 0.11.0.0 or higher.
- Specified by:
deleteRecords
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
recordsToDelete
- The topic partitions and related offsets from which records deletion starts.options
- The options to use when deleting records.- Returns:
- The DeleteRecordsResult.
-
createDelegationToken
default org.apache.kafka.clients.admin.CreateDelegationTokenResult createDelegationToken()Create a Delegation Token.This is a convenience method for
createDelegationToken(CreateDelegationTokenOptions)
with default options. See the overload for more details.- Specified by:
createDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The CreateDelegationTokenResult.
-
createDelegationToken
org.apache.kafka.clients.admin.CreateDelegationTokenResult createDelegationToken(org.apache.kafka.clients.admin.CreateDelegationTokenOptions options) Create a Delegation Token.This operation is supported by brokers with version 1.1.0 or higher.
The following exceptions can be anticipated when calling
get()
on the futures obtained from thedelegationToken()
method of the returnedCreateDelegationTokenResult
UnsupportedByAuthenticationException
If the request sent on PLAINTEXT/1-way SSL channels or delegation token authenticated channels.InvalidPrincipalTypeException
if the renewers principal type is not supported.DelegationTokenDisabledException
if the delegation token feature is disabled.TimeoutException
if the request was not completed in within the givenAbstractOptions.timeoutMs()
.
- Specified by:
createDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when creating delegation token.- Returns:
- The DeleteRecordsResult.
-
renewDelegationToken
default org.apache.kafka.clients.admin.RenewDelegationTokenResult renewDelegationToken(byte[] hmac) Renew a Delegation Token.This is a convenience method for
renewDelegationToken(byte[], RenewDelegationTokenOptions)
with default options. See the overload for more details.- Specified by:
renewDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
hmac
- HMAC of the Delegation token- Returns:
- The RenewDelegationTokenResult.
-
renewDelegationToken
org.apache.kafka.clients.admin.RenewDelegationTokenResult renewDelegationToken(byte[] hmac, org.apache.kafka.clients.admin.RenewDelegationTokenOptions options) Renew a Delegation Token.This operation is supported by brokers with version 1.1.0 or higher.
The following exceptions can be anticipated when calling
get()
on the futures obtained from theexpiryTimestamp()
method of the returnedRenewDelegationTokenResult
UnsupportedByAuthenticationException
If the request sent on PLAINTEXT/1-way SSL channels or delegation token authenticated channels.DelegationTokenDisabledException
if the delegation token feature is disabled.DelegationTokenNotFoundException
if the delegation token is not found on server.DelegationTokenOwnerMismatchException
if the authenticated user is not owner/renewer of the token.DelegationTokenExpiredException
if the delegation token is expired.TimeoutException
if the request was not completed in within the givenAbstractOptions.timeoutMs()
.
- Specified by:
renewDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
hmac
- HMAC of the Delegation tokenoptions
- The options to use when renewing delegation token.- Returns:
- The RenewDelegationTokenResult.
-
expireDelegationToken
default org.apache.kafka.clients.admin.ExpireDelegationTokenResult expireDelegationToken(byte[] hmac) Expire a Delegation Token.This is a convenience method for
expireDelegationToken(byte[], ExpireDelegationTokenOptions)
with default options. This will expire the token immediately. See the overload for more details.- Specified by:
expireDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
hmac
- HMAC of the Delegation token- Returns:
- The ExpireDelegationTokenResult.
-
expireDelegationToken
org.apache.kafka.clients.admin.ExpireDelegationTokenResult expireDelegationToken(byte[] hmac, org.apache.kafka.clients.admin.ExpireDelegationTokenOptions options) Expire a Delegation Token.This operation is supported by brokers with version 1.1.0 or higher.
The following exceptions can be anticipated when calling
get()
on the futures obtained from theexpiryTimestamp()
method of the returnedExpireDelegationTokenResult
UnsupportedByAuthenticationException
If the request sent on PLAINTEXT/1-way SSL channels or delegation token authenticated channels.DelegationTokenDisabledException
if the delegation token feature is disabled.DelegationTokenNotFoundException
if the delegation token is not found on server.DelegationTokenOwnerMismatchException
if the authenticated user is not owner/renewer of the requested token.DelegationTokenExpiredException
if the delegation token is expired.TimeoutException
if the request was not completed in within the givenAbstractOptions.timeoutMs()
.
- Specified by:
expireDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
hmac
- HMAC of the Delegation tokenoptions
- The options to use when expiring delegation token.- Returns:
- The ExpireDelegationTokenResult.
-
describeDelegationToken
default org.apache.kafka.clients.admin.DescribeDelegationTokenResult describeDelegationToken()Describe the Delegation Tokens.This is a convenience method for
describeDelegationToken(DescribeDelegationTokenOptions)
with default options. This will return all the user owned tokens and tokens where user have Describe permission. See the overload for more details.- Specified by:
describeDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The DescribeDelegationTokenResult.
-
describeDelegationToken
org.apache.kafka.clients.admin.DescribeDelegationTokenResult describeDelegationToken(org.apache.kafka.clients.admin.DescribeDelegationTokenOptions options) Describe the Delegation Tokens.This operation is supported by brokers with version 1.1.0 or higher.
The following exceptions can be anticipated when calling
get()
on the futures obtained from thedelegationTokens()
method of the returnedDescribeDelegationTokenResult
UnsupportedByAuthenticationException
If the request sent on PLAINTEXT/1-way SSL channels or delegation token authenticated channels.DelegationTokenDisabledException
if the delegation token feature is disabled.TimeoutException
if the request was not completed in within the givenAbstractOptions.timeoutMs()
.
- Specified by:
describeDelegationToken
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when describing delegation tokens.- Returns:
- The DescribeDelegationTokenResult.
-
describeConsumerGroups
org.apache.kafka.clients.admin.DescribeConsumerGroupsResult describeConsumerGroups(Collection<String> groupIds, org.apache.kafka.clients.admin.DescribeConsumerGroupsOptions options) Describe some group IDs in the cluster.- Specified by:
describeConsumerGroups
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
groupIds
- The IDs of the groups to describe.options
- The options to use when describing the groups.- Returns:
- The DescribeConsumerGroupResult.
-
describeConsumerGroups
default org.apache.kafka.clients.admin.DescribeConsumerGroupsResult describeConsumerGroups(Collection<String> groupIds) Describe some group IDs in the cluster, with the default options.This is a convenience method for
describeConsumerGroups(Collection, DescribeConsumerGroupsOptions)
with default options. See the overload for more details.- Specified by:
describeConsumerGroups
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
groupIds
- The IDs of the groups to describe.- Returns:
- The DescribeConsumerGroupResult.
-
listConsumerGroups
org.apache.kafka.clients.admin.ListConsumerGroupsResult listConsumerGroups(org.apache.kafka.clients.admin.ListConsumerGroupsOptions options) List the consumer groups available in the cluster.- Specified by:
listConsumerGroups
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when listing the consumer groups.- Returns:
- The ListGroupsResult.
-
listConsumerGroups
default org.apache.kafka.clients.admin.ListConsumerGroupsResult listConsumerGroups()List the consumer groups available in the cluster with the default options.This is a convenience method for
listConsumerGroups(ListConsumerGroupsOptions)
with default options. See the overload for more details.- Specified by:
listConsumerGroups
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The ListGroupsResult.
-
listConsumerGroupOffsets
org.apache.kafka.clients.admin.ListConsumerGroupOffsetsResult listConsumerGroupOffsets(String groupId, org.apache.kafka.clients.admin.ListConsumerGroupOffsetsOptions options) List the consumer group offsets available in the cluster.- Specified by:
listConsumerGroupOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when listing the consumer group offsets.- Returns:
- The ListGroupOffsetsResult
-
listConsumerGroupOffsets
default org.apache.kafka.clients.admin.ListConsumerGroupOffsetsResult listConsumerGroupOffsets(String groupId) List the consumer group offsets available in the cluster with the default options.This is a convenience method for
listConsumerGroupOffsets(String, ListConsumerGroupOffsetsOptions)
with default options.- Specified by:
listConsumerGroupOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The ListGroupOffsetsResult.
-
deleteConsumerGroups
org.apache.kafka.clients.admin.DeleteConsumerGroupsResult deleteConsumerGroups(Collection<String> groupIds, org.apache.kafka.clients.admin.DeleteConsumerGroupsOptions options) Delete consumer groups from the cluster.- Specified by:
deleteConsumerGroups
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when deleting a consumer group.- Returns:
- The DeletConsumerGroupResult.
-
deleteConsumerGroups
default org.apache.kafka.clients.admin.DeleteConsumerGroupsResult deleteConsumerGroups(Collection<String> groupIds) Delete consumer groups from the cluster with the default options.- Specified by:
deleteConsumerGroups
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The DeleteConsumerGroupResult.
-
deleteConsumerGroupOffsets
org.apache.kafka.clients.admin.DeleteConsumerGroupOffsetsResult deleteConsumerGroupOffsets(String groupId, Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.DeleteConsumerGroupOffsetsOptions options) Delete committed offsets for a set of partitions in a consumer group. This will succeed at the partition level only if the group is not actively subscribed to the corresponding topic.- Specified by:
deleteConsumerGroupOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use when deleting offsets in a consumer group.- Returns:
- The DeleteConsumerGroupOffsetsResult.
-
deleteConsumerGroupOffsets
default org.apache.kafka.clients.admin.DeleteConsumerGroupOffsetsResult deleteConsumerGroupOffsets(String groupId, Set<org.apache.kafka.common.TopicPartition> partitions) Delete committed offsets for a set of partitions in a consumer group with the default options. This will succeed at the partition level only if the group is not actively subscribed to the corresponding topic.- Specified by:
deleteConsumerGroupOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The DeleteConsumerGroupOffsetsResult.
-
electPreferredLeaders
@Deprecated default org.apache.kafka.clients.admin.ElectLeadersResult electPreferredLeaders(Collection<org.apache.kafka.common.TopicPartition> partitions) Deprecated.Since 2.4.0. UseelectLeaders(ElectionType, Set)
.Elect the preferred replica as leader for topic partitions.This is a convenience method for
electLeaders(ElectionType, Set, ElectLeadersOptions)
with preferred election type and default options.This operation is supported by brokers with version 2.2.0 or higher.
- Parameters:
partitions
- The partitions for which the preferred leader should be elected.- Returns:
- The ElectPreferredLeadersResult.
-
electPreferredLeaders
@Deprecated default org.apache.kafka.clients.admin.ElectLeadersResult electPreferredLeaders(Collection<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.ElectLeadersOptions options) Deprecated.Since 2.4.0. UseelectLeaders(ElectionType, Set, ElectLeadersOptions)
.Elect the preferred replica as leader for topic partitions.This is a convenience method for
electLeaders(ElectionType, Set, ElectLeadersOptions)
with preferred election type.This operation is supported by brokers with version 2.2.0 or higher.
- Parameters:
partitions
- The partitions for which the preferred leader should be elected.options
- The options to use when electing the preferred leaders.- Returns:
- The ElectPreferredLeadersResult.
-
electLeaders
default org.apache.kafka.clients.admin.ElectLeadersResult electLeaders(org.apache.kafka.common.ElectionType electionType, Set<org.apache.kafka.common.TopicPartition> partitions) Elect a replica as leader for topic partitions.This is a convenience method for
electLeaders(ElectionType, Set, ElectLeadersOptions)
with default options.- Specified by:
electLeaders
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
electionType
- The type of election to conduct.partitions
- The topics and partitions for which to conduct elections.- Returns:
- The ElectLeadersResult.
-
electLeaders
org.apache.kafka.clients.admin.ElectLeadersResult electLeaders(org.apache.kafka.common.ElectionType electionType, Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.ElectLeadersOptions options) Elect a replica as leader for the givenpartitions
, or for all partitions if the argument topartitions
is null.This operation is not transactional so it may succeed for some partitions while fail for others.
It may take several seconds after this method returns success for all the brokers in the cluster to become aware that the partitions have new leaders. During this time,
describeTopics(Collection)
may not return information about the partitions' new leaders.This operation is supported by brokers with version 2.2.0 or later if preferred election is use; otherwise the brokers most be 2.4.0 or higher.
The following exceptions can be anticipated when calling
get()
on the future obtained from the returnedElectLeadersResult
:ClusterAuthorizationException
if the authenticated user didn't have alter access to the cluster.UnknownTopicOrPartitionException
if the topic or partition did not exist within the cluster.InvalidTopicException
if the topic was already queued for deletion.NotControllerException
if the request was sent to a broker that was not the controller for the cluster.TimeoutException
if the request timed out before the election was complete.LeaderNotAvailableException
if the preferred leader was not alive or not in the ISR.
- Specified by:
electLeaders
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
electionType
- The type of election to conduct.partitions
- The topics and partitions for which to conduct elections.options
- The options to use when electing the leaders.- Returns:
- The ElectLeadersResult.
-
alterPartitionReassignments
default org.apache.kafka.clients.admin.AlterPartitionReassignmentsResult alterPartitionReassignments(Map<org.apache.kafka.common.TopicPartition, Optional<org.apache.kafka.clients.admin.NewPartitionReassignment>> reassignments) Change the reassignments for one or more partitions. Providing an empty Optional (e.g viaOptional.empty()
) willrevert the reassignment for the associated partition. This is a convenience method foralterPartitionReassignments(Map, AlterPartitionReassignmentsOptions)
with default options. See the overload for more details.- Specified by:
alterPartitionReassignments
in interfaceorg.apache.kafka.clients.admin.Admin
-
alterPartitionReassignments
org.apache.kafka.clients.admin.AlterPartitionReassignmentsResult alterPartitionReassignments(Map<org.apache.kafka.common.TopicPartition, Optional<org.apache.kafka.clients.admin.NewPartitionReassignment>> reassignments, org.apache.kafka.clients.admin.AlterPartitionReassignmentsOptions options) Change the reassignments for one or more partitions. Providing an empty Optional (e.g viaOptional.empty()
) willrevert the reassignment for the associated partition.The following exceptions can be anticipated when calling
get()
on the futures obtained from the returnedAlterPartitionReassignmentsResult
:ClusterAuthorizationException
If the authenticated user didn't have alter access to the cluster.UnknownTopicOrPartitionException
If the topic or partition does not exist within the cluster.TimeoutException
if the request timed out before the controller could record the new assignments.InvalidReplicaAssignmentException
If the specified assignment was not valid.NoReassignmentInProgressException
If there was an attempt to cancel a reassignment for a partition which was not being reassigned.
- Specified by:
alterPartitionReassignments
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
reassignments
- The reassignments to add, modify, or remove. SeeNewPartitionReassignment
.options
- The options to use.- Returns:
- The result.
-
listPartitionReassignments
default org.apache.kafka.clients.admin.ListPartitionReassignmentsResult listPartitionReassignments()List all of the current partition reassignments This is a convenience method forlistPartitionReassignments(ListPartitionReassignmentsOptions)
with default options. See the overload for more details.- Specified by:
listPartitionReassignments
in interfaceorg.apache.kafka.clients.admin.Admin
-
listPartitionReassignments
default org.apache.kafka.clients.admin.ListPartitionReassignmentsResult listPartitionReassignments(Set<org.apache.kafka.common.TopicPartition> partitions) List the current reassignments for the given partitions This is a convenience method forlistPartitionReassignments(Set, ListPartitionReassignmentsOptions)
with default options. See the overload for more details.- Specified by:
listPartitionReassignments
in interfaceorg.apache.kafka.clients.admin.Admin
-
listPartitionReassignments
default org.apache.kafka.clients.admin.ListPartitionReassignmentsResult listPartitionReassignments(Set<org.apache.kafka.common.TopicPartition> partitions, org.apache.kafka.clients.admin.ListPartitionReassignmentsOptions options) List the current reassignments for the given partitionsThe following exceptions can be anticipated when calling
get()
on the futures obtained from the returnedListPartitionReassignmentsResult
:ClusterAuthorizationException
If the authenticated user doesn't have alter access to the cluster.UnknownTopicOrPartitionException
If a given topic or partition does not exist.TimeoutException
If the request timed out before the controller could list the current reassignments.
- Specified by:
listPartitionReassignments
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
partitions
- The topic partitions to list reassignments for.options
- The options to use.- Returns:
- The result.
-
listPartitionReassignments
default org.apache.kafka.clients.admin.ListPartitionReassignmentsResult listPartitionReassignments(org.apache.kafka.clients.admin.ListPartitionReassignmentsOptions options) List all of the current partition reassignmentsThe following exceptions can be anticipated when calling
get()
on the futures obtained from the returnedListPartitionReassignmentsResult
:ClusterAuthorizationException
If the authenticated user doesn't have alter access to the cluster.UnknownTopicOrPartitionException
If a given topic or partition does not exist.TimeoutException
If the request timed out before the controller could list the current reassignments.
- Specified by:
listPartitionReassignments
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- The options to use.- Returns:
- The result.
-
listPartitionReassignments
org.apache.kafka.clients.admin.ListPartitionReassignmentsResult listPartitionReassignments(Optional<Set<org.apache.kafka.common.TopicPartition>> partitions, org.apache.kafka.clients.admin.ListPartitionReassignmentsOptions options) - Specified by:
listPartitionReassignments
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
partitions
- the partitions we want to get reassignment for, or an empty optional if we want to get the reassignments for all partitions in the clusteroptions
- The options to use.- Returns:
- The result.
-
removeMembersFromConsumerGroup
org.apache.kafka.clients.admin.RemoveMembersFromConsumerGroupResult removeMembersFromConsumerGroup(String groupId, org.apache.kafka.clients.admin.RemoveMembersFromConsumerGroupOptions options) Remove members from the consumer group by given member identities.For possible error codes, refer to
LeaveGroupResponse
.- Specified by:
removeMembersFromConsumerGroup
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
groupId
- The ID of the group to remove member from.options
- The options to carry removing members' information.- Returns:
- The MembershipChangeResult.
-
alterConsumerGroupOffsets
default org.apache.kafka.clients.admin.AlterConsumerGroupOffsetsResult alterConsumerGroupOffsets(String groupId, Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets) Alters offsets for the specified group. In order to succeed, the group must be empty.
This is a convenience method for
alterConsumerGroupOffsets(String, Map, AlterConsumerGroupOffsetsOptions)
with default options. See the overload for more details.- Specified by:
alterConsumerGroupOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
groupId
- The group for which to alter offsets.offsets
- A map of offsets by partition with associated metadata.- Returns:
- The AlterOffsetsResult.
-
alterConsumerGroupOffsets
org.apache.kafka.clients.admin.AlterConsumerGroupOffsetsResult alterConsumerGroupOffsets(String groupId, Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.consumer.OffsetAndMetadata> offsets, org.apache.kafka.clients.admin.AlterConsumerGroupOffsetsOptions options) Alters offsets for the specified group. In order to succeed, the group must be empty.
This operation is not transactional so it may succeed for some partitions while fail for others.
- Specified by:
alterConsumerGroupOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
groupId
- The group for which to alter offsets.offsets
- A map of offsets by partition with associated metadata. Partitions not specified in the map are ignored.options
- The options to use when altering the offsets.- Returns:
- The AlterOffsetsResult.
-
listOffsets
default org.apache.kafka.clients.admin.ListOffsetsResult listOffsets(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.OffsetSpec> topicPartitionOffsets) List offset for the specified partitions and OffsetSpec. This operation enables to find the beginning offset, end offset as well as the offset matching a timestamp in partitions.
This is a convenience method for
listOffsets(Map, ListOffsetsOptions)
- Specified by:
listOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
topicPartitionOffsets
- The mapping from partition to the OffsetSpec to look up.- Returns:
- The ListOffsetsResult.
-
listOffsets
org.apache.kafka.clients.admin.ListOffsetsResult listOffsets(Map<org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.admin.OffsetSpec> topicPartitionOffsets, org.apache.kafka.clients.admin.ListOffsetsOptions options) List offset for the specified partitions. This operation enables to find the beginning offset, end offset as well as the offset matching a timestamp in partitions.
- Specified by:
listOffsets
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
topicPartitionOffsets
- The mapping from partition to the OffsetSpec to look up.options
- The options to use when retrieving the offsets- Returns:
- The ListOffsetsResult.
-
describeClientQuotas
default org.apache.kafka.clients.admin.DescribeClientQuotasResult describeClientQuotas(org.apache.kafka.common.quota.ClientQuotaFilter filter) Describes all entities matching the provided filter that have at least one client quota configuration value defined.This is a convenience method for
describeClientQuotas(ClientQuotaFilter, DescribeClientQuotasOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 2.6.0 or higher.
- Specified by:
describeClientQuotas
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
filter
- the filter to apply to match entities- Returns:
- the DescribeClientQuotasResult containing the result
-
describeClientQuotas
org.apache.kafka.clients.admin.DescribeClientQuotasResult describeClientQuotas(org.apache.kafka.common.quota.ClientQuotaFilter filter, org.apache.kafka.clients.admin.DescribeClientQuotasOptions options) Describes all entities matching the provided filter that have at least one client quota configuration value defined.The following exceptions can be anticipated when calling
get()
on the future from the returnedDescribeClientQuotasResult
:ClusterAuthorizationException
If the authenticated user didn't have describe access to the cluster.InvalidRequestException
If the request details are invalid. e.g., an invalid entity type was specified.TimeoutException
If the request timed out before the describe could finish.
This operation is supported by brokers with version 2.6.0 or higher.
- Specified by:
describeClientQuotas
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
filter
- the filter to apply to match entitiesoptions
- the options to use- Returns:
- the DescribeClientQuotasResult containing the result
-
alterClientQuotas
default org.apache.kafka.clients.admin.AlterClientQuotasResult alterClientQuotas(Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries) Alters client quota configurations with the specified alterations.This is a convenience method for
alterClientQuotas(Collection, AlterClientQuotasOptions)
with default options. See the overload for more details.This operation is supported by brokers with version 2.6.0 or higher.
- Specified by:
alterClientQuotas
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
entries
- the alterations to perform- Returns:
- the AlterClientQuotasResult containing the result
-
alterClientQuotas
org.apache.kafka.clients.admin.AlterClientQuotasResult alterClientQuotas(Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries, org.apache.kafka.clients.admin.AlterClientQuotasOptions options) Alters client quota configurations with the specified alterations.Alterations for a single entity are atomic, but across entities is not guaranteed. The resulting per-entity error code should be evaluated to resolve the success or failure of all updates.
The following exceptions can be anticipated when calling
get()
on the futures obtained from the returnedAlterClientQuotasResult
:ClusterAuthorizationException
If the authenticated user didn't have alter access to the cluster.InvalidRequestException
If the request details are invalid. e.g., a configuration key was specified more than once for an entity.TimeoutException
If the request timed out before the alterations could finish. It cannot be guaranteed whether the update succeed or not.
This operation is supported by brokers with version 2.6.0 or higher.
- Specified by:
alterClientQuotas
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
entries
- the alterations to perform- Returns:
- the AlterClientQuotasResult containing the result
-
describeUserScramCredentials
default org.apache.kafka.clients.admin.DescribeUserScramCredentialsResult describeUserScramCredentials()Describe all SASL/SCRAM credentials.This is a convenience method for
describeUserScramCredentials(List, DescribeUserScramCredentialsOptions)
- Specified by:
describeUserScramCredentials
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- The DescribeUserScramCredentialsResult.
-
describeUserScramCredentials
default org.apache.kafka.clients.admin.DescribeUserScramCredentialsResult describeUserScramCredentials(List<String> users) Describe SASL/SCRAM credentials for the given users.This is a convenience method for
describeUserScramCredentials(List, DescribeUserScramCredentialsOptions)
- Specified by:
describeUserScramCredentials
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
users
- the users for which credentials are to be described; all users' credentials are described if null or empty.- Returns:
- The DescribeUserScramCredentialsResult.
-
describeUserScramCredentials
org.apache.kafka.clients.admin.DescribeUserScramCredentialsResult describeUserScramCredentials(List<String> users, org.apache.kafka.clients.admin.DescribeUserScramCredentialsOptions options) Describe SASL/SCRAM credentials.The following exceptions can be anticipated when calling
get()
on the futures from the returnedDescribeUserScramCredentialsResult
:ClusterAuthorizationException
If the authenticated user didn't have describe access to the cluster.ResourceNotFoundException
If the user did not exist/had no SCRAM credentials.DuplicateResourceException
If the user was requested to be described more than once in the original request.TimeoutException
If the request timed out before the describe operation could finish.
This operation is supported by brokers with version 2.7.0 or higher.
- Specified by:
describeUserScramCredentials
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
users
- the users for which credentials are to be described; all users' credentials are described if null or empty.options
- The options to use when describing the credentials- Returns:
- The DescribeUserScramCredentialsResult.
-
alterUserScramCredentials
default org.apache.kafka.clients.admin.AlterUserScramCredentialsResult alterUserScramCredentials(List<org.apache.kafka.clients.admin.UserScramCredentialAlteration> alterations) Alter SASL/SCRAM credentials for the given users.This is a convenience method for
alterUserScramCredentials(List, AlterUserScramCredentialsOptions)
- Specified by:
alterUserScramCredentials
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
alterations
- the alterations to be applied- Returns:
- The AlterUserScramCredentialsResult.
-
alterUserScramCredentials
org.apache.kafka.clients.admin.AlterUserScramCredentialsResult alterUserScramCredentials(List<org.apache.kafka.clients.admin.UserScramCredentialAlteration> alterations, org.apache.kafka.clients.admin.AlterUserScramCredentialsOptions options) Alter SASL/SCRAM credentials.The following exceptions can be anticipated when calling
get()
any of the futures from the returnedAlterUserScramCredentialsResult
:NotControllerException
If the request is not sent to the Controller broker.ClusterAuthorizationException
If the authenticated user didn't have alter access to the cluster.UnsupportedByAuthenticationException
If the user authenticated with a delegation token.UnsupportedSaslMechanismException
If the requested SCRAM mechanism is unrecognized or otherwise unsupported.UnacceptableCredentialException
If the username is empty or the requested number of iterations is too small or too large.TimeoutException
If the request timed out before the describe could finish.
This operation is supported by brokers with version 2.7.0 or higher.
- Specified by:
alterUserScramCredentials
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
alterations
- the alterations to be appliedoptions
- The options to use when altering the credentials- Returns:
- The AlterUserScramCredentialsResult.
-
describeFeatures
default org.apache.kafka.clients.admin.DescribeFeaturesResult describeFeatures()Describes finalized as well as supported features.This is a convenience method for
describeFeatures(DescribeFeaturesOptions)
with default options. See the overload for more details.- Specified by:
describeFeatures
in interfaceorg.apache.kafka.clients.admin.Admin
- Returns:
- the
DescribeFeaturesResult
containing the result
-
describeFeatures
org.apache.kafka.clients.admin.DescribeFeaturesResult describeFeatures(org.apache.kafka.clients.admin.DescribeFeaturesOptions options) Describes finalized as well as supported features. The request is issued to any random broker.The following exceptions can be anticipated when calling
get()
on the future from the returnedDescribeFeaturesResult
:TimeoutException
If the request timed out before the describe operation could finish.
- Specified by:
describeFeatures
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
options
- the options to use- Returns:
- the
DescribeFeaturesResult
containing the result
-
updateFeatures
org.apache.kafka.clients.admin.UpdateFeaturesResult updateFeatures(Map<String, org.apache.kafka.clients.admin.FeatureUpdate> featureUpdates, org.apache.kafka.clients.admin.UpdateFeaturesOptions options) Applies specified updates to finalized features. This operation is not transactional so some updates may succeed while the rest may fail.The API takes in a map of finalized feature names to
FeatureUpdate
that needs to be applied. Each entry in the map specifies the finalized feature to be added or updated or deleted, along with the new max feature version level value. This request is issued only to the controller since the API is only served by the controller. The return value contains an error code for each suppliedFeatureUpdate
, and the code indicates if the update succeeded or failed in the controller.- Downgrade of feature version level is not a regular operation/intent. It is only allowed
in the controller if the
FeatureUpdate
has the allowDowngrade flag set. Setting this flag conveys user intent to attempt downgrade of a feature max version level. Note that despite the allowDowngrade flag being set, certain downgrades may be rejected by the controller if it is deemed impossible. - Deletion of a finalized feature version is not a regular operation/intent. It could be
done by setting the allowDowngrade flag to true in the
FeatureUpdate
, and, setting the max version level to a value less than 1.
The following exceptions can be anticipated when calling
get()
on the futures obtained from the returnedUpdateFeaturesResult
:ClusterAuthorizationException
If the authenticated user didn't have alter access to the cluster.InvalidRequestException
If the request details are invalid. e.g., a non-existing finalized feature is attempted to be deleted or downgraded.TimeoutException
If the request timed out before the updates could finish. It cannot be guaranteed whether the updates succeeded or not.FeatureUpdateFailedException
This means there was an unexpected error encountered when the update was applied on the controller. There is no guarantee on whether the update succeeded or failed. The best way to find out is to issue adescribeFeatures(DescribeFeaturesOptions)
request.
This operation is supported by brokers with version 2.7.0 or higher.
- Specified by:
updateFeatures
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
featureUpdates
- the map of finalized feature name toFeatureUpdate
options
- the options to use- Returns:
- the
UpdateFeaturesResult
containing the result
- Downgrade of feature version level is not a regular operation/intent. It is only allowed
in the controller if the
-
unregisterBroker
@Unstable default org.apache.kafka.clients.admin.UnregisterBrokerResult unregisterBroker(int brokerId) Unregister a broker.This operation does not have any effect on partition assignments. It is supported only on Kafka clusters which use Raft to store metadata, rather than ZooKeeper. This is a convenience method for
unregisterBroker(int, UnregisterBrokerOptions)
- Specified by:
unregisterBroker
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
brokerId
- the broker id to unregister.- Returns:
- the
UnregisterBrokerResult
containing the result
-
unregisterBroker
@Unstable org.apache.kafka.clients.admin.UnregisterBrokerResult unregisterBroker(int brokerId, org.apache.kafka.clients.admin.UnregisterBrokerOptions options) Unregister a broker.This operation does not have any effect on partition assignments. It is supported only on Kafka clusters which use Raft to store metadata, rather than ZooKeeper. The following exceptions can be anticipated when calling
get()
on the future from the returnedUnregisterBrokerResult
:TimeoutException
If the request timed out before the describe operation could finish.UnsupportedVersionException
If the software is too old to support the unregistration API, or if the cluster is not using Raft to store metadata.
- Specified by:
unregisterBroker
in interfaceorg.apache.kafka.clients.admin.Admin
- Parameters:
brokerId
- the broker id to unregister.options
- the options to use.- Returns:
- the
UnregisterBrokerResult
containing the result
-
metrics
Map<org.apache.kafka.common.MetricName,? extends org.apache.kafka.common.Metric> metrics()Get the metrics kept by the adminClient- Specified by:
metrics
in interfaceorg.apache.kafka.clients.admin.Admin
-