@InterfaceStability.Evolving public interface Admin extends java.lang.AutoCloseable
The minimum broker version required is 0.10.0.0. Methods with stricter requirements will specify the minimum broker version required.
This client was introduced in 0.11.0.0 and the API is still evolving. We will try to evolve the API in a compatible
manner, but we reserve the right to make breaking changes in minor releases, if necessary. We will update the
InterfaceStability
annotation and this notice once the API is considered stable.
Modifier and Type | Method and Description |
---|---|
default AlterClientQuotasResult |
alterClientQuotas(java.util.Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries)
Alters client quota configurations with the specified alterations.
|
AlterClientQuotasResult |
alterClientQuotas(java.util.Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries,
AlterClientQuotasOptions options)
Alters client quota configurations with the specified alterations.
|
default AlterConfigsResult |
alterConfigs(java.util.Map<ConfigResource,Config> configs)
Deprecated.
Since 2.3. Use
incrementalAlterConfigs(Map) . |
AlterConfigsResult |
alterConfigs(java.util.Map<ConfigResource,Config> configs,
AlterConfigsOptions options)
Deprecated.
Since 2.3. Use
incrementalAlterConfigs(Map, AlterConfigsOptions) . |
default AlterConsumerGroupOffsetsResult |
alterConsumerGroupOffsets(java.lang.String groupId,
java.util.Map<TopicPartition,OffsetAndMetadata> offsets)
Alters offsets for the specified group.
|
AlterConsumerGroupOffsetsResult |
alterConsumerGroupOffsets(java.lang.String groupId,
java.util.Map<TopicPartition,OffsetAndMetadata> offsets,
AlterConsumerGroupOffsetsOptions options)
Alters offsets for the specified group.
|
default AlterPartitionReassignmentsResult |
alterPartitionReassignments(java.util.Map<TopicPartition,java.util.Optional<NewPartitionReassignment>> reassignments)
Change the reassignments for one or more partitions.
|
AlterPartitionReassignmentsResult |
alterPartitionReassignments(java.util.Map<TopicPartition,java.util.Optional<NewPartitionReassignment>> reassignments,
AlterPartitionReassignmentsOptions options)
Change the reassignments for one or more partitions.
|
default AlterReplicaLogDirsResult |
alterReplicaLogDirs(java.util.Map<TopicPartitionReplica,java.lang.String> replicaAssignment)
Change the log directory for the specified replicas.
|
AlterReplicaLogDirsResult |
alterReplicaLogDirs(java.util.Map<TopicPartitionReplica,java.lang.String> replicaAssignment,
AlterReplicaLogDirsOptions options)
Change the log directory for the specified replicas.
|
default AlterUserScramCredentialsResult |
alterUserScramCredentials(java.util.List<UserScramCredentialAlteration> alterations)
Alter SASL/SCRAM credentials for the given users.
|
AlterUserScramCredentialsResult |
alterUserScramCredentials(java.util.List<UserScramCredentialAlteration> alterations,
AlterUserScramCredentialsOptions options)
Alter SASL/SCRAM credentials.
|
default void |
close()
Close the Admin and release all associated resources.
|
void |
close(java.time.Duration timeout)
Close the Admin client and release all associated resources.
|
default void |
close(long duration,
java.util.concurrent.TimeUnit unit)
Deprecated.
Since 2.2. Use
close(Duration) or close() . |
static Admin |
create(java.util.Map<java.lang.String,java.lang.Object> conf)
Create a new Admin with the given configuration.
|
static Admin |
create(java.util.Properties props)
Create a new Admin with the given configuration.
|
default CreateAclsResult |
createAcls(java.util.Collection<AclBinding> acls)
This is a convenience method for
createAcls(Collection, CreateAclsOptions) with
default options. |
CreateAclsResult |
createAcls(java.util.Collection<AclBinding> acls,
CreateAclsOptions options)
Creates access control lists (ACLs) which are bound to specific resources.
|
default CreateDelegationTokenResult |
createDelegationToken()
Create a Delegation Token.
|
CreateDelegationTokenResult |
createDelegationToken(CreateDelegationTokenOptions options)
Create a Delegation Token.
|
default CreatePartitionsResult |
createPartitions(java.util.Map<java.lang.String,NewPartitions> newPartitions)
Increase the number of partitions of the topics given as the keys of
newPartitions
according to the corresponding values. |
CreatePartitionsResult |
createPartitions(java.util.Map<java.lang.String,NewPartitions> newPartitions,
CreatePartitionsOptions options)
Increase the number of partitions of the topics given as the keys of
newPartitions
according to the corresponding values. |
default CreateTopicsResult |
createTopics(java.util.Collection<NewTopic> newTopics)
Create a batch of new topics with the default options.
|
CreateTopicsResult |
createTopics(java.util.Collection<NewTopic> newTopics,
CreateTopicsOptions options)
Create a batch of new topics.
|
default DeleteAclsResult |
deleteAcls(java.util.Collection<AclBindingFilter> filters)
This is a convenience method for
deleteAcls(Collection, DeleteAclsOptions) with default options. |
DeleteAclsResult |
deleteAcls(java.util.Collection<AclBindingFilter> filters,
DeleteAclsOptions options)
Deletes access control lists (ACLs) according to the supplied filters.
|
default DeleteConsumerGroupOffsetsResult |
deleteConsumerGroupOffsets(java.lang.String groupId,
java.util.Set<TopicPartition> partitions)
Delete committed offsets for a set of partitions in a consumer group with the default
options.
|
DeleteConsumerGroupOffsetsResult |
deleteConsumerGroupOffsets(java.lang.String groupId,
java.util.Set<TopicPartition> partitions,
DeleteConsumerGroupOffsetsOptions options)
Delete committed offsets for a set of partitions in a consumer group.
|
default DeleteConsumerGroupsResult |
deleteConsumerGroups(java.util.Collection<java.lang.String> groupIds)
Delete consumer groups from the cluster with the default options.
|
DeleteConsumerGroupsResult |
deleteConsumerGroups(java.util.Collection<java.lang.String> groupIds,
DeleteConsumerGroupsOptions options)
Delete consumer groups from the cluster.
|
default DeleteRecordsResult |
deleteRecords(java.util.Map<TopicPartition,RecordsToDelete> recordsToDelete)
Delete records whose offset is smaller than the given offset of the corresponding partition.
|
DeleteRecordsResult |
deleteRecords(java.util.Map<TopicPartition,RecordsToDelete> recordsToDelete,
DeleteRecordsOptions options)
Delete records whose offset is smaller than the given offset of the corresponding partition.
|
default DeleteTopicsResult |
deleteTopics(java.util.Collection<java.lang.String> topics)
This is a convenience method for
deleteTopics(Collection, DeleteTopicsOptions)
with default options. |
DeleteTopicsResult |
deleteTopics(java.util.Collection<java.lang.String> topics,
DeleteTopicsOptions options)
Delete a batch of topics.
|
default DescribeAclsResult |
describeAcls(AclBindingFilter filter)
This is a convenience method for
describeAcls(AclBindingFilter, DescribeAclsOptions) with
default options. |
DescribeAclsResult |
describeAcls(AclBindingFilter filter,
DescribeAclsOptions options)
Lists access control lists (ACLs) according to the supplied filter.
|
default 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.
|
DescribeClientQuotasResult |
describeClientQuotas(org.apache.kafka.common.quota.ClientQuotaFilter filter,
DescribeClientQuotasOptions options)
Describes all entities matching the provided filter that have at least one client quota configuration
value defined.
|
default DescribeClusterResult |
describeCluster()
Get information about the nodes in the cluster, using the default options.
|
DescribeClusterResult |
describeCluster(DescribeClusterOptions options)
Get information about the nodes in the cluster.
|
default DescribeConfigsResult |
describeConfigs(java.util.Collection<ConfigResource> resources)
Get the configuration for the specified resources with the default options.
|
DescribeConfigsResult |
describeConfigs(java.util.Collection<ConfigResource> resources,
DescribeConfigsOptions options)
Get the configuration for the specified resources.
|
default DescribeConsumerGroupsResult |
describeConsumerGroups(java.util.Collection<java.lang.String> groupIds)
Describe some group IDs in the cluster, with the default options.
|
DescribeConsumerGroupsResult |
describeConsumerGroups(java.util.Collection<java.lang.String> groupIds,
DescribeConsumerGroupsOptions options)
Describe some group IDs in the cluster.
|
default DescribeDelegationTokenResult |
describeDelegationToken()
Describe the Delegation Tokens.
|
DescribeDelegationTokenResult |
describeDelegationToken(DescribeDelegationTokenOptions options)
Describe the Delegation Tokens.
|
default DescribeFeaturesResult |
describeFeatures()
Describes finalized as well as supported features.
|
DescribeFeaturesResult |
describeFeatures(DescribeFeaturesOptions options)
Describes finalized as well as supported features.
|
default DescribeLogDirsResult |
describeLogDirs(java.util.Collection<java.lang.Integer> brokers)
Query the information of all log directories on the given set of brokers
|
DescribeLogDirsResult |
describeLogDirs(java.util.Collection<java.lang.Integer> brokers,
DescribeLogDirsOptions options)
Query the information of all log directories on the given set of brokers
|
default DescribeReplicaLogDirsResult |
describeReplicaLogDirs(java.util.Collection<TopicPartitionReplica> replicas)
Query the replica log directory information for the specified replicas.
|
DescribeReplicaLogDirsResult |
describeReplicaLogDirs(java.util.Collection<TopicPartitionReplica> replicas,
DescribeReplicaLogDirsOptions options)
Query the replica log directory information for the specified replicas.
|
default DescribeTopicsResult |
describeTopics(java.util.Collection<java.lang.String> topicNames)
Describe some topics in the cluster, with the default options.
|
DescribeTopicsResult |
describeTopics(java.util.Collection<java.lang.String> topicNames,
DescribeTopicsOptions options)
Describe some topics in the cluster.
|
default DescribeUserScramCredentialsResult |
describeUserScramCredentials()
Describe all SASL/SCRAM credentials.
|
default DescribeUserScramCredentialsResult |
describeUserScramCredentials(java.util.List<java.lang.String> users)
Describe SASL/SCRAM credentials for the given users.
|
DescribeUserScramCredentialsResult |
describeUserScramCredentials(java.util.List<java.lang.String> users,
DescribeUserScramCredentialsOptions options)
Describe SASL/SCRAM credentials.
|
default ElectLeadersResult |
electLeaders(ElectionType electionType,
java.util.Set<TopicPartition> partitions)
Elect a replica as leader for topic partitions.
|
ElectLeadersResult |
electLeaders(ElectionType electionType,
java.util.Set<TopicPartition> partitions,
ElectLeadersOptions options)
Elect a replica as leader for the given
partitions , or for all partitions if the argument
to partitions is null. |
default ElectPreferredLeadersResult |
electPreferredLeaders(java.util.Collection<TopicPartition> partitions)
Deprecated.
Since 2.4.0. Use
electLeaders(ElectionType, Set) . |
default ElectPreferredLeadersResult |
electPreferredLeaders(java.util.Collection<TopicPartition> partitions,
ElectPreferredLeadersOptions options)
Deprecated.
Since 2.4.0. Use
electLeaders(ElectionType, Set, ElectLeadersOptions) . |
default ExpireDelegationTokenResult |
expireDelegationToken(byte[] hmac)
Expire a Delegation Token.
|
ExpireDelegationTokenResult |
expireDelegationToken(byte[] hmac,
ExpireDelegationTokenOptions options)
Expire a Delegation Token.
|
default AlterConfigsResult |
incrementalAlterConfigs(java.util.Map<ConfigResource,java.util.Collection<AlterConfigOp>> configs)
Incrementally updates the configuration for the specified resources with default options.
|
AlterConfigsResult |
incrementalAlterConfigs(java.util.Map<ConfigResource,java.util.Collection<AlterConfigOp>> configs,
AlterConfigsOptions options)
Incrementally update the configuration for the specified resources.
|
default ListConsumerGroupOffsetsResult |
listConsumerGroupOffsets(java.lang.String groupId)
List the consumer group offsets available in the cluster with the default options.
|
ListConsumerGroupOffsetsResult |
listConsumerGroupOffsets(java.lang.String groupId,
ListConsumerGroupOffsetsOptions options)
List the consumer group offsets available in the cluster.
|
default ListConsumerGroupsResult |
listConsumerGroups()
List the consumer groups available in the cluster with the default options.
|
ListConsumerGroupsResult |
listConsumerGroups(ListConsumerGroupsOptions options)
List the consumer groups available in the cluster.
|
default ListOffsetsResult |
listOffsets(java.util.Map<TopicPartition,OffsetSpec> topicPartitionOffsets)
List offset for the specified partitions and OffsetSpec.
|
ListOffsetsResult |
listOffsets(java.util.Map<TopicPartition,OffsetSpec> topicPartitionOffsets,
ListOffsetsOptions options)
List offset for the specified partitions.
|
default ListPartitionReassignmentsResult |
listPartitionReassignments()
List all of the current partition reassignments
This is a convenience method for
listPartitionReassignments(ListPartitionReassignmentsOptions)
with default options. |
default ListPartitionReassignmentsResult |
listPartitionReassignments(ListPartitionReassignmentsOptions options)
List all of the current partition reassignments
|
ListPartitionReassignmentsResult |
listPartitionReassignments(java.util.Optional<java.util.Set<TopicPartition>> partitions,
ListPartitionReassignmentsOptions options) |
default ListPartitionReassignmentsResult |
listPartitionReassignments(java.util.Set<TopicPartition> partitions)
List the current reassignments for the given partitions
This is a convenience method for
listPartitionReassignments(Set, ListPartitionReassignmentsOptions)
with default options. |
default ListPartitionReassignmentsResult |
listPartitionReassignments(java.util.Set<TopicPartition> partitions,
ListPartitionReassignmentsOptions options)
List the current reassignments for the given partitions
|
default ListTopicsResult |
listTopics()
List the topics available in the cluster with the default options.
|
ListTopicsResult |
listTopics(ListTopicsOptions options)
List the topics available in the cluster.
|
java.util.Map<MetricName,? extends Metric> |
metrics()
Get the metrics kept by the adminClient
|
RemoveMembersFromConsumerGroupResult |
removeMembersFromConsumerGroup(java.lang.String groupId,
RemoveMembersFromConsumerGroupOptions options)
Remove members from the consumer group by given member identities.
|
default RenewDelegationTokenResult |
renewDelegationToken(byte[] hmac)
Renew a Delegation Token.
|
RenewDelegationTokenResult |
renewDelegationToken(byte[] hmac,
RenewDelegationTokenOptions options)
Renew a Delegation Token.
|
UpdateFeaturesResult |
updateFeatures(java.util.Map<java.lang.String,FeatureUpdate> featureUpdates,
UpdateFeaturesOptions options)
Applies specified updates to finalized features.
|
static Admin create(java.util.Properties props)
props
- The configuration.static Admin create(java.util.Map<java.lang.String,java.lang.Object> conf)
conf
- The configuration.default void close()
close
in interface java.lang.AutoCloseable
@Deprecated default void close(long duration, java.util.concurrent.TimeUnit unit)
close(Duration)
or close()
.
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
.
duration
- The duration to use for the wait time.unit
- The time unit to use for the wait time.void close(java.time.Duration timeout)
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
.
timeout
- The time to use for the wait time.default CreateTopicsResult createTopics(java.util.Collection<NewTopic> newTopics)
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.
newTopics
- The new topics to create.CreateTopicsResult createTopics(java.util.Collection<NewTopic> newTopics, CreateTopicsOptions options)
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()
and describeTopics(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.
newTopics
- The new topics to create.options
- The options to use when creating the new topics.default DeleteTopicsResult deleteTopics(java.util.Collection<java.lang.String> topics)
deleteTopics(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.
topics
- The topic names to delete.DeleteTopicsResult deleteTopics(java.util.Collection<java.lang.String> topics, DeleteTopicsOptions options)
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()
and describeTopics(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.
topics
- The topic names to delete.options
- The options to use when deleting the topics.default ListTopicsResult listTopics()
This is a convenience method for listTopics(ListTopicsOptions)
with default options.
See the overload for more details.
ListTopicsResult listTopics(ListTopicsOptions options)
options
- The options to use when listing the topics.default DescribeTopicsResult describeTopics(java.util.Collection<java.lang.String> topicNames)
This is a convenience method for describeTopics(Collection, DescribeTopicsOptions)
with
default options. See the overload for more details.
topicNames
- The names of the topics to describe.DescribeTopicsResult describeTopics(java.util.Collection<java.lang.String> topicNames, DescribeTopicsOptions options)
topicNames
- The names of the topics to describe.options
- The options to use when describing the topic.default DescribeClusterResult describeCluster()
This is a convenience method for describeCluster(DescribeClusterOptions)
with default options.
See the overload for more details.
DescribeClusterResult describeCluster(DescribeClusterOptions options)
options
- The options to use when getting information about the cluster.default DescribeAclsResult describeAcls(AclBindingFilter filter)
describeAcls(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.
filter
- The filter to use.DescribeAclsResult describeAcls(AclBindingFilter filter, DescribeAclsOptions options)
Note: it may take some time for changes made by createAcls
or deleteAcls
to be reflected
in the output of describeAcls
.
This operation is supported by brokers with version 0.11.0.0 or higher.
filter
- The filter to use.options
- The options to use when listing the ACLs.default CreateAclsResult createAcls(java.util.Collection<AclBinding> acls)
createAcls(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.
acls
- The ACLs to createCreateAclsResult createAcls(java.util.Collection<AclBinding> acls, CreateAclsOptions options)
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.
acls
- The ACLs to createoptions
- The options to use when creating the ACLs.default DeleteAclsResult deleteAcls(java.util.Collection<AclBindingFilter> filters)
deleteAcls(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.
filters
- The filters to use.DeleteAclsResult deleteAcls(java.util.Collection<AclBindingFilter> filters, DeleteAclsOptions options)
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.
filters
- The filters to use.options
- The options to use when deleting the ACLs.default DescribeConfigsResult describeConfigs(java.util.Collection<ConfigResource> resources)
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.
resources
- The resources (topic and broker resource types are currently supported)DescribeConfigsResult describeConfigs(java.util.Collection<ConfigResource> resources, DescribeConfigsOptions options)
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.
resources
- The resources (topic and broker resource types are currently supported)options
- The options to use when describing configs@Deprecated default AlterConfigsResult alterConfigs(java.util.Map<ConfigResource,Config> configs)
incrementalAlterConfigs(Map)
.
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.
configs
- The resources with their configs (topic is the only resource type with configs that can
be updated currently)@Deprecated AlterConfigsResult alterConfigs(java.util.Map<ConfigResource,Config> configs, AlterConfigsOptions options)
incrementalAlterConfigs(Map, AlterConfigsOptions)
.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.
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 configsdefault AlterConfigsResult incrementalAlterConfigs(java.util.Map<ConfigResource,java.util.Collection<AlterConfigOp>> configs)
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.
configs
- The resources with their configsAlterConfigsResult incrementalAlterConfigs(java.util.Map<ConfigResource,java.util.Collection<AlterConfigOp>> configs, AlterConfigsOptions 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.
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned AlterConfigsResult
:
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 resourceThis operation is supported by brokers with version 2.3.0 or higher.
configs
- The resources with their configsoptions
- The options to use when altering configsdefault AlterReplicaLogDirsResult alterReplicaLogDirs(java.util.Map<TopicPartitionReplica,java.lang.String> replicaAssignment)
AlterReplicaLogDirsResult
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.
replicaAssignment
- The replicas with their log directory absolute pathjava.lang.InterruptedException
- Interrupted while joining I/O threadAlterReplicaLogDirsResult alterReplicaLogDirs(java.util.Map<TopicPartitionReplica,java.lang.String> replicaAssignment, AlterReplicaLogDirsOptions options)
AlterReplicaLogDirsResult
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.
replicaAssignment
- The replicas with their log directory absolute pathoptions
- The options to use when changing replica dirjava.lang.InterruptedException
- Interrupted while joining I/O threaddefault DescribeLogDirsResult describeLogDirs(java.util.Collection<java.lang.Integer> brokers)
This 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.
brokers
- A list of brokersDescribeLogDirsResult describeLogDirs(java.util.Collection<java.lang.Integer> brokers, DescribeLogDirsOptions options)
This operation is supported by brokers with version 1.0.0 or higher.
brokers
- A list of brokersoptions
- The options to use when querying log dir infodefault DescribeReplicaLogDirsResult describeReplicaLogDirs(java.util.Collection<TopicPartitionReplica> 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.
replicas
- The replicas to queryDescribeReplicaLogDirsResult describeReplicaLogDirs(java.util.Collection<TopicPartitionReplica> replicas, DescribeReplicaLogDirsOptions options)
This operation is supported by brokers with version 1.0.0 or higher.
replicas
- The replicas to queryoptions
- The options to use when querying replica log dir infodefault CreatePartitionsResult createPartitions(java.util.Map<java.lang.String,NewPartitions> newPartitions)
newPartitions
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.
newPartitions
- The topics which should have new partitions created, and corresponding parameters
for the created partitions.CreatePartitionsResult createPartitions(java.util.Map<java.lang.String,NewPartitions> newPartitions, CreatePartitionsOptions options)
newPartitions
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 the
values()
method of the returned CreatePartitionsResult
AuthorizationException
if the authenticated user is not authorized to alter the topicTimeoutException
if the request was not completed in within the given AbstractOptions.timeoutMs()
.ReassignmentInProgressException
if a partition reassignment is currently in progressBrokerNotAvailableException
if the requested NewPartitions.assignments()
contain a broker that is currently unavailable.InvalidReplicationFactorException
if no NewPartitions.assignments()
are given and it is impossible for the broker to assign
replicas with the topics replication factor.KafkaException
if the request is invalid in some way.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.default DeleteRecordsResult deleteRecords(java.util.Map<TopicPartition,RecordsToDelete> recordsToDelete)
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.
recordsToDelete
- The topic partitions and related offsets from which records deletion starts.DeleteRecordsResult deleteRecords(java.util.Map<TopicPartition,RecordsToDelete> recordsToDelete, DeleteRecordsOptions options)
This operation is supported by brokers with version 0.11.0.0 or higher.
recordsToDelete
- The topic partitions and related offsets from which records deletion starts.options
- The options to use when deleting records.default CreateDelegationTokenResult createDelegationToken()
This is a convenience method for createDelegationToken(CreateDelegationTokenOptions)
with default options.
See the overload for more details.
CreateDelegationTokenResult createDelegationToken(CreateDelegationTokenOptions options)
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 the
delegationToken()
method of the returned CreateDelegationTokenResult
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 given AbstractOptions.timeoutMs()
.options
- The options to use when creating delegation token.default RenewDelegationTokenResult renewDelegationToken(byte[] hmac)
This is a convenience method for renewDelegationToken(byte[], RenewDelegationTokenOptions)
with default options.
See the overload for more details.
hmac
- HMAC of the Delegation tokenRenewDelegationTokenResult renewDelegationToken(byte[] hmac, RenewDelegationTokenOptions options)
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 the
expiryTimestamp()
method of the returned RenewDelegationTokenResult
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 given AbstractOptions.timeoutMs()
.hmac
- HMAC of the Delegation tokenoptions
- The options to use when renewing delegation token.default ExpireDelegationTokenResult expireDelegationToken(byte[] hmac)
This is a convenience method for expireDelegationToken(byte[], ExpireDelegationTokenOptions)
with default options.
This will expire the token immediately. See the overload for more details.
hmac
- HMAC of the Delegation tokenExpireDelegationTokenResult expireDelegationToken(byte[] hmac, ExpireDelegationTokenOptions options)
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 the
expiryTimestamp()
method of the returned ExpireDelegationTokenResult
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 given AbstractOptions.timeoutMs()
.hmac
- HMAC of the Delegation tokenoptions
- The options to use when expiring delegation token.default DescribeDelegationTokenResult describeDelegationToken()
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.
DescribeDelegationTokenResult describeDelegationToken(DescribeDelegationTokenOptions options)
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 the
delegationTokens()
method of the returned DescribeDelegationTokenResult
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 given AbstractOptions.timeoutMs()
.options
- The options to use when describing delegation tokens.DescribeConsumerGroupsResult describeConsumerGroups(java.util.Collection<java.lang.String> groupIds, DescribeConsumerGroupsOptions options)
groupIds
- The IDs of the groups to describe.options
- The options to use when describing the groups.default DescribeConsumerGroupsResult describeConsumerGroups(java.util.Collection<java.lang.String> groupIds)
This is a convenience method for describeConsumerGroups(Collection, DescribeConsumerGroupsOptions)
with default options. See the overload for more details.
groupIds
- The IDs of the groups to describe.ListConsumerGroupsResult listConsumerGroups(ListConsumerGroupsOptions options)
options
- The options to use when listing the consumer groups.default ListConsumerGroupsResult listConsumerGroups()
This is a convenience method for listConsumerGroups(ListConsumerGroupsOptions)
with default options.
See the overload for more details.
ListConsumerGroupOffsetsResult listConsumerGroupOffsets(java.lang.String groupId, ListConsumerGroupOffsetsOptions options)
options
- The options to use when listing the consumer group offsets.default ListConsumerGroupOffsetsResult listConsumerGroupOffsets(java.lang.String groupId)
This is a convenience method for listConsumerGroupOffsets(String, ListConsumerGroupOffsetsOptions)
with default options.
DeleteConsumerGroupsResult deleteConsumerGroups(java.util.Collection<java.lang.String> groupIds, DeleteConsumerGroupsOptions options)
options
- The options to use when deleting a consumer group.default DeleteConsumerGroupsResult deleteConsumerGroups(java.util.Collection<java.lang.String> groupIds)
DeleteConsumerGroupOffsetsResult deleteConsumerGroupOffsets(java.lang.String groupId, java.util.Set<TopicPartition> partitions, DeleteConsumerGroupOffsetsOptions options)
options
- The options to use when deleting offsets in a consumer group.default DeleteConsumerGroupOffsetsResult deleteConsumerGroupOffsets(java.lang.String groupId, java.util.Set<TopicPartition> partitions)
@Deprecated default ElectPreferredLeadersResult electPreferredLeaders(java.util.Collection<TopicPartition> partitions)
electLeaders(ElectionType, Set)
.
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.
partitions
- The partitions for which the preferred leader should be elected.@Deprecated default ElectPreferredLeadersResult electPreferredLeaders(java.util.Collection<TopicPartition> partitions, ElectPreferredLeadersOptions options)
electLeaders(ElectionType, Set, ElectLeadersOptions)
.
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.
partitions
- The partitions for which the preferred leader should be elected.options
- The options to use when electing the preferred leaders.default ElectLeadersResult electLeaders(ElectionType electionType, java.util.Set<TopicPartition> partitions)
This is a convenience method for electLeaders(ElectionType, Set, ElectLeadersOptions)
with default options.
electionType
- The type of election to conduct.partitions
- The topics and partitions for which to conduct elections.ElectLeadersResult electLeaders(ElectionType electionType, java.util.Set<TopicPartition> partitions, ElectLeadersOptions options)
partitions
, or for all partitions if the argument
to partitions
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 returned ElectLeadersResult
:
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.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.default AlterPartitionReassignmentsResult alterPartitionReassignments(java.util.Map<TopicPartition,java.util.Optional<NewPartitionReassignment>> reassignments)
Optional.empty()
) will alterPartitionReassignments(Map, AlterPartitionReassignmentsOptions)
with default options. See the overload for more details.AlterPartitionReassignmentsResult alterPartitionReassignments(java.util.Map<TopicPartition,java.util.Optional<NewPartitionReassignment>> reassignments, AlterPartitionReassignmentsOptions options)
Optional.empty()
) will The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned AlterPartitionReassignmentsResult
:
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.reassignments
- The reassignments to add, modify, or remove. See NewPartitionReassignment
.options
- The options to use.default ListPartitionReassignmentsResult listPartitionReassignments()
listPartitionReassignments(ListPartitionReassignmentsOptions)
with default options. See the overload for more details.default ListPartitionReassignmentsResult listPartitionReassignments(java.util.Set<TopicPartition> partitions)
listPartitionReassignments(Set, ListPartitionReassignmentsOptions)
with default options. See the overload for more details.default ListPartitionReassignmentsResult listPartitionReassignments(java.util.Set<TopicPartition> partitions, ListPartitionReassignmentsOptions options)
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned ListPartitionReassignmentsResult
:
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.partitions
- The topic partitions to list reassignments for.options
- The options to use.default ListPartitionReassignmentsResult listPartitionReassignments(ListPartitionReassignmentsOptions options)
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned ListPartitionReassignmentsResult
:
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.options
- The options to use.ListPartitionReassignmentsResult listPartitionReassignments(java.util.Optional<java.util.Set<TopicPartition>> partitions, ListPartitionReassignmentsOptions options)
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.RemoveMembersFromConsumerGroupResult removeMembersFromConsumerGroup(java.lang.String groupId, RemoveMembersFromConsumerGroupOptions options)
For possible error codes, refer to LeaveGroupResponse
.
groupId
- The ID of the group to remove member from.options
- The options to carry removing members' information.default AlterConsumerGroupOffsetsResult alterConsumerGroupOffsets(java.lang.String groupId, java.util.Map<TopicPartition,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.
groupId
- The group for which to alter offsets.offsets
- A map of offsets by partition with associated metadata.AlterConsumerGroupOffsetsResult alterConsumerGroupOffsets(java.lang.String groupId, java.util.Map<TopicPartition,OffsetAndMetadata> offsets, 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.
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.default ListOffsetsResult listOffsets(java.util.Map<TopicPartition,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)
topicPartitionOffsets
- The mapping from partition to the OffsetSpec to look up.ListOffsetsResult listOffsets(java.util.Map<TopicPartition,OffsetSpec> topicPartitionOffsets, 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.
topicPartitionOffsets
- The mapping from partition to the OffsetSpec to look up.options
- The options to use when retrieving the offsetsdefault DescribeClientQuotasResult describeClientQuotas(org.apache.kafka.common.quota.ClientQuotaFilter filter)
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.
filter
- the filter to apply to match entitiesDescribeClientQuotasResult describeClientQuotas(org.apache.kafka.common.quota.ClientQuotaFilter filter, DescribeClientQuotasOptions options)
The following exceptions can be anticipated when calling get()
on the future from the
returned DescribeClientQuotasResult
:
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.
filter
- the filter to apply to match entitiesoptions
- the options to usedefault AlterClientQuotasResult alterClientQuotas(java.util.Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries)
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.
entries
- the alterations to performAlterClientQuotasResult alterClientQuotas(java.util.Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries, AlterClientQuotasOptions options)
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 returned AlterClientQuotasResult
:
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.
entries
- the alterations to performdefault DescribeUserScramCredentialsResult describeUserScramCredentials()
This is a convenience method for describeUserScramCredentials(List, DescribeUserScramCredentialsOptions)
default DescribeUserScramCredentialsResult describeUserScramCredentials(java.util.List<java.lang.String> users)
This is a convenience method for describeUserScramCredentials(List, DescribeUserScramCredentialsOptions)
users
- the users for which credentials are to be described; all users' credentials are described if null
or empty.DescribeUserScramCredentialsResult describeUserScramCredentials(java.util.List<java.lang.String> users, DescribeUserScramCredentialsOptions options)
The following exceptions can be anticipated when calling get()
on the futures from the
returned DescribeUserScramCredentialsResult
:
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.
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 credentialsdefault AlterUserScramCredentialsResult alterUserScramCredentials(java.util.List<UserScramCredentialAlteration> alterations)
This is a convenience method for alterUserScramCredentials(List, AlterUserScramCredentialsOptions)
alterations
- the alterations to be appliedAlterUserScramCredentialsResult alterUserScramCredentials(java.util.List<UserScramCredentialAlteration> alterations, AlterUserScramCredentialsOptions options)
The following exceptions can be anticipated when calling get()
any of the futures from the
returned AlterUserScramCredentialsResult
:
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.
alterations
- the alterations to be appliedoptions
- The options to use when altering the credentialsdefault DescribeFeaturesResult describeFeatures()
This is a convenience method for describeFeatures(DescribeFeaturesOptions)
with default options.
See the overload for more details.
DescribeFeaturesResult
containing the resultDescribeFeaturesResult describeFeatures(DescribeFeaturesOptions options)
The following exceptions can be anticipated when calling get()
on the future from the
returned DescribeFeaturesResult
:
TimeoutException
If the request timed out before the describe operation could finish.options
- the options to useDescribeFeaturesResult
containing the resultUpdateFeaturesResult updateFeatures(java.util.Map<java.lang.String,FeatureUpdate> featureUpdates, UpdateFeaturesOptions options)
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 supplied FeatureUpdate
, and the code indicates if the update
succeeded or failed in the controller.
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.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 returned UpdateFeaturesResult
:
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 a describeFeatures(DescribeFeaturesOptions)
request to the controller to get the latest features.This operation is supported by brokers with version 2.7.0 or higher.
featureUpdates
- the map of finalized feature name to FeatureUpdate
options
- the options to useUpdateFeaturesResult
containing the resultjava.util.Map<MetricName,? extends Metric> metrics()