@InterfaceStability.Evolving public class KafkaAdminClient extends AdminClient implements ConfluentAdmin
Modifier and Type | Method and Description |
---|---|
AlterClientQuotasResult |
alterClientQuotas(java.util.Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries,
AlterClientQuotasOptions options)
Alters client quota configurations with the specified alterations.
|
AlterConfigsResult |
alterConfigs(java.util.Map<ConfigResource,Config> configs,
AlterConfigsOptions options)
Deprecated.
|
AlterConsumerGroupOffsetsResult |
alterConsumerGroupOffsets(java.lang.String groupId,
java.util.Map<TopicPartition,OffsetAndMetadata> offsets,
AlterConsumerGroupOffsetsOptions options)
Alters offsets for the specified group.
|
AlterMirrorsResult |
alterMirrors(java.util.List<org.apache.kafka.common.requests.AlterMirrorsRequest.Op> ops,
AlterMirrorsOptions options)
Performs a state alteration for topic mirroring.
|
AlterPartitionReassignmentsResult |
alterPartitionReassignments(java.util.Map<TopicPartition,java.util.Optional<NewPartitionReassignment>> reassignments,
AlterPartitionReassignmentsOptions options)
Change the reassignments for one or more partitions.
|
AlterReplicaLogDirsResult |
alterReplicaLogDirs(java.util.Map<TopicPartitionReplica,java.lang.String> replicaAssignment,
AlterReplicaLogDirsOptions options)
Change the log directory for the specified replicas.
|
AlterUserScramCredentialsResult |
alterUserScramCredentials(java.util.List<UserScramCredentialAlteration> alterations,
AlterUserScramCredentialsOptions options)
Alter SASL/SCRAM credentials.
|
org.apache.kafka.clients.KafkaClient |
client() |
void |
close(java.time.Duration timeout)
Close the Admin client and release all associated resources.
|
CreateAclsResult |
createAcls(java.util.Collection<AclBinding> acls,
CreateAclsOptions options)
Creates access control lists (ACLs) which are bound to specific resources.
|
CreateAclsResult |
createCentralizedAcls(java.util.Collection<AclBinding> acls,
CreateAclsOptions options,
java.lang.String clusterId,
int writerBrokerId)
Creates access control lists (ACLs) which are bound to specific resources.
|
CreateClusterLinksResult |
createClusterLinks(java.util.Collection<org.apache.kafka.common.requests.NewClusterLink> clusterLinks,
CreateClusterLinksOptions options)
Creates links to remote clusters with the specified configurations for performing inter-cluster
communications.
|
CreateDelegationTokenResult |
createDelegationToken(CreateDelegationTokenOptions options)
Create a Delegation Token.
|
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. |
CreateTopicsResult |
createTopics(java.util.Collection<NewTopic> newTopics,
CreateTopicsOptions options)
Create a batch of new topics.
|
DeleteAclsResult |
deleteAcls(java.util.Collection<AclBindingFilter> filters,
DeleteAclsOptions options)
Deletes access control lists (ACLs) according to the supplied filters.
|
DeleteAclsResult |
deleteCentralizedAcls(java.util.Collection<AclBindingFilter> filters,
DeleteAclsOptions options,
java.lang.String clusterId,
int writerBrokerId)
Deletes access control lists (ACLs) according to the supplied filters.
|
DeleteClusterLinksResult |
deleteClusterLinks(java.util.Collection<java.lang.String> linkNames,
DeleteClusterLinksOptions options)
Deletes established links to remote clusters with the provided link names.
|
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.
|
DeleteConsumerGroupsResult |
deleteConsumerGroups(java.util.Collection<java.lang.String> groupIds,
DeleteConsumerGroupsOptions options)
Delete consumer groups from the cluster.
|
DeleteRecordsResult |
deleteRecords(java.util.Map<TopicPartition,RecordsToDelete> recordsToDelete,
DeleteRecordsOptions options)
Delete records whose offset is smaller than the given offset of the corresponding partition.
|
DeleteTopicsResult |
deleteTopics(java.util.Collection<java.lang.String> topicNames,
DeleteTopicsOptions options)
Delete a batch of topics.
|
DescribeAclsResult |
describeAcls(AclBindingFilter filter,
DescribeAclsOptions options)
Lists access control lists (ACLs) according to the supplied filter.
|
DescribeBrokerAdditionsResult |
describeBrokerAdditions(DescribeBrokerAdditionsOptions options)
Describes all the broker additions in the cluster.
|
DescribeBrokerRemovalsResult |
describeBrokerRemovals(DescribeBrokerRemovalsOptions options)
Describes all the broker removals in the cluster.
|
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.
|
DescribeClusterResult |
describeCluster(DescribeClusterOptions options)
Get information about the nodes in the cluster.
|
DescribeConfigsResult |
describeConfigs(java.util.Collection<ConfigResource> configResources,
DescribeConfigsOptions options)
Get the configuration for the specified resources.
|
DescribeConsumerGroupsResult |
describeConsumerGroups(java.util.Collection<java.lang.String> groupIds,
DescribeConsumerGroupsOptions options)
Describe some group IDs in the cluster.
|
DescribeDelegationTokenResult |
describeDelegationToken(DescribeDelegationTokenOptions options)
Describe the Delegation Tokens.
|
DescribeFeaturesResult |
describeFeatures(DescribeFeaturesOptions options)
Describes finalized as well as supported features.
|
DescribeLogDirsResult |
describeLogDirs(java.util.Collection<java.lang.Integer> brokers,
DescribeLogDirsOptions options)
Query the information of all log directories on the given set of brokers
|
DescribeMirrorsResult |
describeMirrors(java.util.Collection<java.lang.String> topics,
DescribeMirrorsOptions options)
Describes the state of mirrored topics, i.e.
|
DescribeReplicaLogDirsResult |
describeReplicaLogDirs(java.util.Collection<TopicPartitionReplica> replicas,
DescribeReplicaLogDirsOptions options)
Query the replica log directory information for the specified replicas.
|
DescribeTopicsResult |
describeTopics(java.util.Collection<java.lang.String> topicNames,
DescribeTopicsOptions options)
Describe some topics in the cluster.
|
DescribeUserScramCredentialsResult |
describeUserScramCredentials(java.util.List<java.lang.String> users,
DescribeUserScramCredentialsOptions options)
Describe SASL/SCRAM credentials.
|
ElectLeadersResult |
electLeaders(ElectionType electionType,
java.util.Set<TopicPartition> topicPartitions,
ElectLeadersOptions options)
Elect a replica as leader for the given
partitions , or for all partitions if the argument
to partitions is null. |
ExpireDelegationTokenResult |
expireDelegationToken(byte[] hmac,
ExpireDelegationTokenOptions options)
Expire a Delegation Token.
|
AlterConfigsResult |
incrementalAlterConfigs(java.util.Map<ConfigResource,java.util.Collection<AlterConfigOp>> configs,
AlterConfigsOptions options)
Incrementally update the configuration for the specified resources.
|
ListClusterLinksResult |
listClusterLinks(ListClusterLinksOptions options)
Lists the cluster links.
|
ListConsumerGroupOffsetsResult |
listConsumerGroupOffsets(java.lang.String groupId,
ListConsumerGroupOffsetsOptions options)
List the consumer group offsets available in the cluster.
|
ListConsumerGroupsResult |
listConsumerGroups(ListConsumerGroupsOptions options)
List the consumer groups available in the cluster.
|
ListMirrorsResult |
listMirrors(ListMirrorsOptions options)
Lists the mirrored topics, i.e.
|
ListOffsetsResult |
listOffsets(java.util.Map<TopicPartition,OffsetSpec> topicPartitionOffsets,
ListOffsetsOptions options)
List offset for the specified partitions.
|
ListPartitionReassignmentsResult |
listPartitionReassignments(java.util.Optional<java.util.Set<TopicPartition>> partitions,
ListPartitionReassignmentsOptions 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
|
RemoveBrokersResult |
removeBrokers(java.util.List<java.lang.Integer> brokersToRemove,
RemoveBrokersOptions options)
Drain data off a given set of brokers and remove them from the cluster via shutdown.
|
RemoveMembersFromConsumerGroupResult |
removeMembersFromConsumerGroup(java.lang.String groupId,
RemoveMembersFromConsumerGroupOptions options)
Remove members from the consumer group by given member identities.
|
RenewDelegationTokenResult |
renewDelegationToken(byte[] hmac,
RenewDelegationTokenOptions options)
Renew a Delegation Token.
|
ReplicaStatusResult |
replicaStatus(java.util.Set<TopicPartition> partitions,
ReplicaStatusOptions options)
Retrieves the status of the replicas for a set of partitions, including observers.
|
UpdateFeaturesResult |
updateFeatures(java.util.Map<java.lang.String,FeatureUpdate> featureUpdates,
UpdateFeaturesOptions options)
Applies specified updates to finalized features.
|
create, create
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, create, describeBrokerAdditions, describeBrokerRemovals, removeBrokers
alterClientQuotas, alterConfigs, alterConsumerGroupOffsets, alterPartitionReassignments, alterReplicaLogDirs, alterUserScramCredentials, close, close, createAcls, createDelegationToken, createPartitions, createTopics, deleteAcls, deleteConsumerGroupOffsets, deleteConsumerGroups, deleteRecords, deleteTopics, describeAcls, describeClientQuotas, describeCluster, describeConfigs, describeConsumerGroups, describeDelegationToken, describeFeatures, describeLogDirs, describeReplicaLogDirs, describeTopics, describeUserScramCredentials, describeUserScramCredentials, electLeaders, electPreferredLeaders, electPreferredLeaders, expireDelegationToken, incrementalAlterConfigs, listConsumerGroupOffsets, listConsumerGroups, listOffsets, listPartitionReassignments, listPartitionReassignments, listPartitionReassignments, listPartitionReassignments, listTopics, renewDelegationToken
public void close(java.time.Duration timeout)
Admin
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
.
public org.apache.kafka.clients.KafkaClient client()
public CreateTopicsResult createTopics(java.util.Collection<NewTopic> newTopics, CreateTopicsOptions options)
Admin
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, Admin.listTopics()
and Admin.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.
createTopics
in interface Admin
newTopics
- The new topics to create.options
- The options to use when creating the new topics.public DeleteTopicsResult deleteTopics(java.util.Collection<java.lang.String> topicNames, DeleteTopicsOptions options)
Admin
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, Admin.listTopics()
and Admin.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.
deleteTopics
in interface Admin
topicNames
- The topic names to delete.options
- The options to use when deleting the topics.public ListTopicsResult listTopics(ListTopicsOptions options)
Admin
listTopics
in interface Admin
options
- The options to use when listing the topics.public DescribeTopicsResult describeTopics(java.util.Collection<java.lang.String> topicNames, DescribeTopicsOptions options)
Admin
describeTopics
in interface Admin
topicNames
- The names of the topics to describe.options
- The options to use when describing the topic.public DescribeClusterResult describeCluster(DescribeClusterOptions options)
Admin
describeCluster
in interface Admin
options
- The options to use when getting information about the cluster.public DescribeAclsResult describeAcls(AclBindingFilter filter, DescribeAclsOptions options)
Admin
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.
describeAcls
in interface Admin
filter
- The filter to use.options
- The options to use when listing the ACLs.public CreateAclsResult createAcls(java.util.Collection<AclBinding> acls, CreateAclsOptions options)
Admin
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.
createAcls
in interface Admin
acls
- The ACLs to createoptions
- The options to use when creating the ACLs.@Confluent public CreateAclsResult createCentralizedAcls(java.util.Collection<AclBinding> acls, CreateAclsOptions options, java.lang.String clusterId, int writerBrokerId)
ConfluentAdmin
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.
createCentralizedAcls
in interface ConfluentAdmin
acls
- The ACLs to createoptions
- The options to use when creating the ACLs.clusterId
- Cluster id for which ACLs are being updatedwriterBrokerId
- Broker id of the current centralized metadata master writerpublic DeleteAclsResult deleteAcls(java.util.Collection<AclBindingFilter> filters, DeleteAclsOptions options)
Admin
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.
deleteAcls
in interface Admin
filters
- The filters to use.options
- The options to use when deleting the ACLs.@Confluent public DeleteAclsResult deleteCentralizedAcls(java.util.Collection<AclBindingFilter> filters, DeleteAclsOptions options, java.lang.String clusterId, int writerBrokerId)
ConfluentAdmin
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.
deleteCentralizedAcls
in interface ConfluentAdmin
filters
- The filters to use.options
- The options to use when deleting the ACLs.clusterId
- Cluster id for which ACLs are being updatedwriterBrokerId
- Broker id of the current centralized metadata master writerpublic DescribeConfigsResult describeConfigs(java.util.Collection<ConfigResource> configResources, DescribeConfigsOptions options)
Admin
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.
describeConfigs
in interface Admin
configResources
- The resources (topic and broker resource types are currently supported)options
- The options to use when describing configs@Deprecated public AlterConfigsResult alterConfigs(java.util.Map<ConfigResource,Config> configs, AlterConfigsOptions options)
Admin
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.
alterConfigs
in interface Admin
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 configspublic AlterConfigsResult incrementalAlterConfigs(java.util.Map<ConfigResource,java.util.Collection<AlterConfigOp>> configs, AlterConfigsOptions options)
Admin
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.
incrementalAlterConfigs
in interface Admin
configs
- The resources with their configsoptions
- The options to use when altering configspublic AlterReplicaLogDirsResult alterReplicaLogDirs(java.util.Map<TopicPartitionReplica,java.lang.String> replicaAssignment, AlterReplicaLogDirsOptions options)
Admin
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.
alterReplicaLogDirs
in interface Admin
replicaAssignment
- The replicas with their log directory absolute pathoptions
- The options to use when changing replica dirpublic DescribeLogDirsResult describeLogDirs(java.util.Collection<java.lang.Integer> brokers, DescribeLogDirsOptions options)
Admin
This operation is supported by brokers with version 1.0.0 or higher.
describeLogDirs
in interface Admin
brokers
- A list of brokersoptions
- The options to use when querying log dir infopublic DescribeReplicaLogDirsResult describeReplicaLogDirs(java.util.Collection<TopicPartitionReplica> replicas, DescribeReplicaLogDirsOptions options)
Admin
This operation is supported by brokers with version 1.0.0 or higher.
describeReplicaLogDirs
in interface Admin
replicas
- The replicas to queryoptions
- The options to use when querying replica log dir infopublic CreatePartitionsResult createPartitions(java.util.Map<java.lang.String,NewPartitions> newPartitions, CreatePartitionsOptions options)
Admin
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, Admin.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.createPartitions
in interface Admin
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.public DeleteRecordsResult deleteRecords(java.util.Map<TopicPartition,RecordsToDelete> recordsToDelete, DeleteRecordsOptions options)
Admin
This operation is supported by brokers with version 0.11.0.0 or higher.
deleteRecords
in interface Admin
recordsToDelete
- The topic partitions and related offsets from which records deletion starts.options
- The options to use when deleting records.public CreateDelegationTokenResult createDelegationToken(CreateDelegationTokenOptions options)
Admin
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()
.createDelegationToken
in interface Admin
options
- The options to use when creating delegation token.public RenewDelegationTokenResult renewDelegationToken(byte[] hmac, RenewDelegationTokenOptions options)
Admin
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()
.renewDelegationToken
in interface Admin
hmac
- HMAC of the Delegation tokenoptions
- The options to use when renewing delegation token.public ExpireDelegationTokenResult expireDelegationToken(byte[] hmac, ExpireDelegationTokenOptions options)
Admin
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()
.expireDelegationToken
in interface Admin
hmac
- HMAC of the Delegation tokenoptions
- The options to use when expiring delegation token.public DescribeDelegationTokenResult describeDelegationToken(DescribeDelegationTokenOptions options)
Admin
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()
.describeDelegationToken
in interface Admin
options
- The options to use when describing delegation tokens.public DescribeConsumerGroupsResult describeConsumerGroups(java.util.Collection<java.lang.String> groupIds, DescribeConsumerGroupsOptions options)
Admin
describeConsumerGroups
in interface Admin
groupIds
- The IDs of the groups to describe.options
- The options to use when describing the groups.public ListConsumerGroupsResult listConsumerGroups(ListConsumerGroupsOptions options)
Admin
listConsumerGroups
in interface Admin
options
- The options to use when listing the consumer groups.public ListConsumerGroupOffsetsResult listConsumerGroupOffsets(java.lang.String groupId, ListConsumerGroupOffsetsOptions options)
Admin
listConsumerGroupOffsets
in interface Admin
options
- The options to use when listing the consumer group offsets.public DeleteConsumerGroupsResult deleteConsumerGroups(java.util.Collection<java.lang.String> groupIds, DeleteConsumerGroupsOptions options)
Admin
deleteConsumerGroups
in interface Admin
options
- The options to use when deleting a consumer group.public DeleteConsumerGroupOffsetsResult deleteConsumerGroupOffsets(java.lang.String groupId, java.util.Set<TopicPartition> partitions, DeleteConsumerGroupOffsetsOptions options)
Admin
deleteConsumerGroupOffsets
in interface Admin
options
- The options to use when deleting offsets in a consumer group.public java.util.Map<MetricName,? extends Metric> metrics()
Admin
public ElectLeadersResult electLeaders(ElectionType electionType, java.util.Set<TopicPartition> topicPartitions, ElectLeadersOptions options)
Admin
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,
Admin.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.electLeaders
in interface Admin
electionType
- The type of election to conduct.topicPartitions
- The topics and partitions for which to conduct elections.options
- The options to use when electing the leaders.public AlterPartitionReassignmentsResult alterPartitionReassignments(java.util.Map<TopicPartition,java.util.Optional<NewPartitionReassignment>> reassignments, AlterPartitionReassignmentsOptions options)
Admin
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.alterPartitionReassignments
in interface Admin
reassignments
- The reassignments to add, modify, or remove. See NewPartitionReassignment
.options
- The options to use.public ListPartitionReassignmentsResult listPartitionReassignments(java.util.Optional<java.util.Set<TopicPartition>> partitions, ListPartitionReassignmentsOptions options)
listPartitionReassignments
in interface Admin
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.@Confluent public ReplicaStatusResult replicaStatus(java.util.Set<TopicPartition> partitions, ReplicaStatusOptions options)
ConfluentAdmin
The status of the replicas will be as witnessed by the partition leader. That is, the replicas themselves may be further in progress than what's provided, however the leader has not yet processed that state update.
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned ReplicaStatusResult
:
TopicAuthorizationException
If the authenticated user didn't have describe access to the Topic.UnknownTopicOrPartitionException
If a given topic or partition does not exist.NotLeaderOrFollowerException
If the partition leader changed while the request was outstanding.TimeoutException
If the request timed out before the controller could retrieve the partition's replica status.replicaStatus
in interface ConfluentAdmin
partitions
- The partitions to retrieve replica status for.options
- The options to use.public RemoveMembersFromConsumerGroupResult removeMembersFromConsumerGroup(java.lang.String groupId, RemoveMembersFromConsumerGroupOptions options)
Admin
For possible error codes, refer to LeaveGroupResponse
.
removeMembersFromConsumerGroup
in interface Admin
groupId
- The ID of the group to remove member from.options
- The options to carry removing members' information.public AlterConsumerGroupOffsetsResult alterConsumerGroupOffsets(java.lang.String groupId, java.util.Map<TopicPartition,OffsetAndMetadata> offsets, AlterConsumerGroupOffsetsOptions options)
Admin
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.
alterConsumerGroupOffsets
in interface Admin
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.public ListOffsetsResult listOffsets(java.util.Map<TopicPartition,OffsetSpec> topicPartitionOffsets, ListOffsetsOptions options)
Admin
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.
listOffsets
in interface Admin
topicPartitionOffsets
- The mapping from partition to the OffsetSpec to look up.options
- The options to use when retrieving the offsetspublic DescribeClientQuotasResult describeClientQuotas(org.apache.kafka.common.quota.ClientQuotaFilter filter, DescribeClientQuotasOptions options)
Admin
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.
describeClientQuotas
in interface Admin
filter
- the filter to apply to match entitiesoptions
- the options to usepublic AlterClientQuotasResult alterClientQuotas(java.util.Collection<org.apache.kafka.common.quota.ClientQuotaAlteration> entries, AlterClientQuotasOptions options)
Admin
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.
alterClientQuotas
in interface Admin
entries
- the alterations to performpublic DescribeUserScramCredentialsResult describeUserScramCredentials(java.util.List<java.lang.String> users, DescribeUserScramCredentialsOptions options)
Admin
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.
describeUserScramCredentials
in interface Admin
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 credentialspublic AlterUserScramCredentialsResult alterUserScramCredentials(java.util.List<UserScramCredentialAlteration> alterations, AlterUserScramCredentialsOptions options)
Admin
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.
alterUserScramCredentials
in interface Admin
alterations
- the alterations to be appliedoptions
- The options to use when altering the credentials@Confluent public RemoveBrokersResult removeBrokers(java.util.List<java.lang.Integer> brokersToRemove, RemoveBrokersOptions options)
ConfluentAdmin
ConfluentAdmin.describeBrokerRemovals()
Once initiated, the brokers will be shut down and replicas will be reassigned away from them.
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned RemoveBrokersResult
:
ClusterAuthorizationException
If we didn't have sufficient permission to initiate the broker removal. None of the requests started. TimeoutException
If the request timed out before the controller could initiate the broker removal.
It cannot be guaranteed whether the removal was initiated or not. BalancerOfflineException
If the Confluent Balancer component is disabled or not started yet. BalancerOperationFailedException
If the operation failed during execution of the removal. InsufficientRebalancePlanMetricsException
If computing the rebalance plan for broker removal failed due to insufficient metrics. RebalancePlanComputationException
If computing the rebalance plan for broker removal failed for reasons other than
insufficient metrics like not enough disk space, replication factor same as the cluster size
in case of broker removal etc. InvalidBrokerRemovalException
If requested broker removal operation is invalid, examples being a non-existent
broker ID or some partitions (RF=1) becoming unavailable as a result of the removal. BrokerRemovalInProgressException
If the broker is already being removed. BrokerRemovedException
If the broker was already removed successfully. removeBrokers
in interface ConfluentAdmin
brokersToRemove
- The broker IDs to drain off partition replicas and shut down. Must not be empty.options
- The options to use for the request.@Confluent public DescribeBrokerAdditionsResult describeBrokerAdditions(DescribeBrokerAdditionsOptions options)
ConfluentAdmin
PartitionReassignmentsStatus.ERROR
- when the broker addition operation failed midway
2. PartitionReassignmentsStatus.PENDING
- when the intent of addition is registered but the balancer is yet to start on it (e.g still collecting metrics)
3. PartitionReassignmentsStatus.CANCELED
- when the addition is canceled (e.g due to a higher priority operation coming through)
4. PartitionReassignmentsStatus.IN_PROGRESS
- when the addition is in progress (replicas are being reassigned)
5. PartitionReassignmentsStatus.COMPLETED
- when the broker has successfully been added to the cluster
The operation's status is also exposed through the general #BalancerOperationStatus
, which can be in one of the following statuses:
1. #BalancerOperationStatus.FAILED
- when the operation has ceased before completing due to an external influence canceling it or an internal error failing it.
2. #BalancerOperationStatus.IN_PROGRESS
- when the intent of the operation is registered and is in the process of being completed.
3. #BalancerOperationStatus.SUCCESS
- when the balancer operation has completed successfully.
Additionally, each broker addition exposes a #BrokerAdditionDescription.additionError()
that provides additional context regarding the reason the operation is in the given status
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned DescribeBrokerAdditionsResult
:
BalancerOfflineException
If the Confluent Balancer component is disabled or not started yet.ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.TimeoutException
If the request timed out before the controller could describe the removals.describeBrokerAdditions
in interface ConfluentAdmin
options
- The options to use when describing the broker additions@Confluent public DescribeBrokerRemovalsResult describeBrokerRemovals(DescribeBrokerRemovalsOptions options)
ConfluentAdmin
BrokerRemovalDescription.shutdownStatus()
, a #BrokerShutdownStatus
denoting the status of the shutdown operation
2. #BrokerRemovalDescription.reassignmentsStatus()
, a #PartitionReassignmentsStatus
denoting the status of the partition reassignments operation
When at least one of the two has a failed status, the broker removal operation is considered failed. The user is expected to retry the removal via #ConfluentAdmin.removeBrokers(List)
.
When both have a completed status, the broker removal operation is considered a success.
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned DescribeBrokerRemovalsResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.TimeoutException
If the request timed out before the controller could describe the removals.BalancerOfflineException
If the Confluent Balancer component is disabled or not started yet.describeBrokerRemovals
in interface ConfluentAdmin
options
- The options to use when describing the broker removals.@Confluent public CreateClusterLinksResult createClusterLinks(java.util.Collection<org.apache.kafka.common.requests.NewClusterLink> clusterLinks, CreateClusterLinksOptions options)
ConfluentAdmin
get()
on the futures obtained from
the returned CreateClusterLinksResult
:
InvalidClusterLinkException
If the cluster link name is illegal.ClusterAuthorizationException
If the authenticated user didn't have CREATE
access to the cluster.ClusterLinkExistsException
If a cluster link already exists for the provided link name.TimeoutException
If the request timed out before the controller could create the cluster link.createClusterLinks
in interface ConfluentAdmin
clusterLinks
- The cluster links to create.options
- The options to use when creating the cluster links.@Confluent public ListClusterLinksResult listClusterLinks(ListClusterLinksOptions options)
ConfluentAdmin
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned ListClusterLinksResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE_CONFIGS
access to the cluster.TimeoutException
If the request timed out before the controller could list the cluster links.listClusterLinks
in interface ConfluentAdmin
options
- The options to use when listing the cluster links.@Confluent public DeleteClusterLinksResult deleteClusterLinks(java.util.Collection<java.lang.String> linkNames, DeleteClusterLinksOptions options)
ConfluentAdmin
Deleting a cluster link does not affect the cluster link's data in any way.
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned DeleteClusterLinksResult
:
InvalidClusterLinkException
If the cluster link name is illegal.ClusterAuthorizationException
If the authenticated user didn't have DELETE
access to the cluster.ClusterLinkNotFoundException
If the cluster link to delete doesn't exist.TimeoutException
If the request timed out before the controller could delete the cluster link.deleteClusterLinks
in interface ConfluentAdmin
linkNames
- The names of the cluster links to delete.options
- The options to use when deleting the cluster links.@Confluent public AlterMirrorsResult alterMirrors(java.util.List<org.apache.kafka.common.requests.AlterMirrorsRequest.Op> ops, AlterMirrorsOptions options)
ConfluentAdmin
The future of the individual alter mirror ops should be used for obtaining the result.
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned AlterMirrorsResult
:
ClusterAuthorizationException
If the authenticated user didn't have ALTER
access to the cluster.TimeoutException
If the request timed out before the controller could complete the mirror operation.alterMirrors
in interface ConfluentAdmin
ops
- The mirror alteration operations.options
- The options to use when altering mirrors.@Confluent public ListMirrorsResult listMirrors(ListMirrorsOptions options)
ConfluentAdmin
The following exceptions can be anticipated when calling get()
on the future obtained from
the returned ListMirrorsResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.ClusterLinkNotFoundException
If a specific cluster link was requested and the cluster link doesn't exist.TimeoutException
If the request timed out before the controller could complete the operation.listMirrors
in interface ConfluentAdmin
options
- The options to use when describing mirrors.@Confluent public DescribeMirrorsResult describeMirrors(java.util.Collection<java.lang.String> topics, DescribeMirrorsOptions options)
ConfluentAdmin
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned DescribeMirrorsResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.TimeoutException
If the request timed out before the controller could complete the operation.describeMirrors
in interface ConfluentAdmin
options
- The options to use when describing mirrors.public DescribeFeaturesResult describeFeatures(DescribeFeaturesOptions options)
Admin
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.describeFeatures
in interface Admin
options
- the options to useDescribeFeaturesResult
containing the resultpublic UpdateFeaturesResult updateFeatures(java.util.Map<java.lang.String,FeatureUpdate> featureUpdates, UpdateFeaturesOptions options)
Admin
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 Admin.describeFeatures(DescribeFeaturesOptions)
request to the controller to get the latest features.This operation is supported by brokers with version 2.7.0 or higher.
updateFeatures
in interface Admin
featureUpdates
- the map of finalized feature name to FeatureUpdate
options
- the options to useUpdateFeaturesResult
containing the result