@InterfaceStability.Evolving public class KafkaAdminClient extends AdminClient implements ConfluentAdmin
create, create
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
alterBrokerReplicaExclusions, computeEvenClusterLoadPlan, create, create, describeBalancerStatus, describeBrokerAdditions, describeBrokerRemovals, describeBrokerReplicaExclusions, describeEvenClusterLoadStatus, removeBrokers, triggerEvenClusterLoad
abortTransaction, alterClientQuotas, alterConfigs, alterConsumerGroupOffsets, alterPartitionReassignments, alterReplicaLogDirs, alterUserScramCredentials, close, createAcls, createDelegationToken, createPartitions, createTopics, deleteAcls, deleteConsumerGroupOffsets, deleteConsumerGroups, deleteRecords, deleteTopics, deleteTopics, deleteTopics, describeAcls, describeClientQuotas, describeCluster, describeConfigs, describeConsumerGroups, describeDelegationToken, describeFeatures, describeLogDirs, describeMetadataQuorum, describeProducers, describeReplicaLogDirs, describeTopics, describeTopics, describeTopics, describeTransactions, describeUserScramCredentials, describeUserScramCredentials, electLeaders, expireDelegationToken, fenceProducers, incrementalAlterConfigs, listConsumerGroupOffsets, listConsumerGroupOffsets, listConsumerGroupOffsets, listConsumerGroups, listOffsets, listPartitionReassignments, listPartitionReassignments, listPartitionReassignments, listPartitionReassignments, listTopics, listTransactions, renewDelegationToken, unregisterBroker
public void close(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 CreateTopicsResult createTopics(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(TopicCollection topics, 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.
When using topic IDs, this operation is supported by brokers with inter-broker protocol 2.8 or higher. When using topic names, this operation is supported by brokers with version 0.10.1.0 or higher.
deleteTopics
in interface Admin
topics
- The topics 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(TopicCollection topics, DescribeTopicsOptions options)
Admin
describeTopics
in interface Admin
topics
- The topics to describe.options
- The options to use when describing the topics.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(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(Collection<AclBinding> acls, CreateAclsOptions options, 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(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(Collection<AclBindingFilter> filters, DeleteAclsOptions options, 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(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(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(Map<ConfigResource,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(Map<TopicPartitionReplica,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(Collection<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(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(Map<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(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(Collection<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(Map<String,ListConsumerGroupOffsetsSpec> groupSpecs, ListConsumerGroupOffsetsOptions options)
Admin
listConsumerGroupOffsets
in interface Admin
groupSpecs
- Map of consumer group ids to a spec that specifies the topic partitions of the group to list offsets for.options
- The options to use when listing the consumer group offsets.public DeleteConsumerGroupsResult deleteConsumerGroups(Collection<String> groupIds, DeleteConsumerGroupsOptions options)
Admin
deleteConsumerGroups
in interface Admin
options
- The options to use when deleting a consumer group.public DeleteConsumerGroupOffsetsResult deleteConsumerGroupOffsets(String groupId, Set<TopicPartition> partitions, DeleteConsumerGroupOffsetsOptions options)
Admin
deleteConsumerGroupOffsets
in interface Admin
options
- The options to use when deleting offsets in a consumer group.public Map<MetricName,? extends Metric> metrics()
Admin
public ElectLeadersResult electLeaders(ElectionType electionType, 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(Map<TopicPartition,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(Optional<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(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(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(String groupId, 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(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(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(Collection<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(List<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(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 AlterBrokerReplicaExclusionsResult alterBrokerReplicaExclusions(Map<Integer,ExclusionOp> operations, AlterBrokerReplicaExclusionsOptions options)
ConfluentAdmin
ExclusionOp
s or fail for all.
The following exceptions can be anticipated when calling get()
on the future
obtained from the returned AlterBrokerReplicaExclusionsResult
:
ClusterAuthorizationException
If the authenticated user didn't have ALTER
access to the cluster.TimeoutException
If the request timed out before the controller could fetch even cluster load status.InvalidBrokerReplicaExclusionException
If any given ExclusionOp.reason()
is invalid (for the constraints, see ExclusionOp.reason()
),
or any other exception.UnrepresentableBrokerIdException
If an invalid broker ID was provided.BrokerReplicaExclusionNotFoundException
If an attempt to remove an exclusion which doesn't exist is made.alterBrokerReplicaExclusions
in interface ConfluentAdmin
operations
- a map of broker ID to the desired ExclusionOp
to be performed on that broker.options
- The options to use when altering the broker replica exclusions.@Confluent public DescribeBrokerReplicaExclusionsResult describeBrokerReplicaExclusions(DescribeBrokerReplicaExclusionsOptions options)
ConfluentAdmin
get()
on the future
obtained from the returned DescribeBrokerReplicaExclusionsResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.TimeoutException
If the request timed out before the controller could fetch even cluster load status.describeBrokerReplicaExclusions
in interface ConfluentAdmin
options
- The options to use when describing the broker replica exclusions.@Confluent public RemoveBrokersResult removeBrokers(List<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. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationBalancerLoadError
If the Confluent Balancer component failed to load. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationBalancerOperationFailedException
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. BalancerBrokerExcludedForReplicaPlacementException
If there are active broker replica exclusions in the cluster for brokers that are not part of the removal request.
See ConfluentAdmin.describeBrokerReplicaExclusions()
for more information 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.public DescribeMetadataQuorumResult describeMetadataQuorum(DescribeMetadataQuorumOptions options)
Admin
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned DescribeMetadataQuorumResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.TimeoutException
If the request timed out before the controller could list the cluster links.describeMetadataQuorum
in interface Admin
options
- The DescribeMetadataQuorumOptions
to use when describing the quorum.DescribeMetadataQuorumResult
containing the result@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. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationBalancerLoadError
If the Confluent Balancer component failed to load. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationClusterAuthorizationException
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. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationBalancerLoadError
If the Confluent Balancer component failed to load. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationdescribeBrokerRemovals
in interface ConfluentAdmin
options
- The options to use when describing the broker removals.@Confluent public DescribeBalancerStatusResult describeBalancerStatus(DescribeBalancerStatusOptions options)
ConfluentAdmin
BalancerStatus
.
In addition to the status field, the #BalancerStatusDescription.balancerOperationError()
gives context about the status of the balancer, e.g. why the balancer is in error state etc.
The following exceptions can be anticipated when calling get()
on the future
obtained from the returned DescribeBalancerStatusResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.TimeoutException
If the request timed out before the controller could fetch balancer status.describeBalancerStatus
in interface ConfluentAdmin
options
- The options to use when fetching the balancer status.public TriggerEvenClusterLoadResult triggerEvenClusterLoad(TriggerEvenClusterLoadOptions options)
ConfluentAdmin
ConfluentConfigs.BALANCER_AUTO_HEAL_MODE_CONFIG
is configured to
ConfluentConfigs.BalancerSelfHealMode.ANY_UNEVEN_LOAD
,
then Confluent Balancer is continuously monitoring the cluster and determining whether it
can improve the balance of the cluster's load. This API helps manually trigger the operation.
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned TriggerEvenClusterLoadResult
:
ClusterAuthorizationException
If we didn't have sufficient permission to request rebalance. The request would not be started. TimeoutException
If the request timed out as no response was received from the controller, possible reasons
could be request was faulted or response being dropped due to some network issue etc. The
status of the even cluster load is unknown in this case.
BalancerOfflineException
If the Confluent Balancer component is disabled or not started yet. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationBalancerLoadError
If the Confluent Balancer component failed to load. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationBrokerRemovalInProgressException
If a broker removal operation is in progress. BrokerAdditionInProgressException
If a broker addition operation is in progress. EvenClusterLoadTaskInProgressException
If an even cluster load operation is already in progress. triggerEvenClusterLoad
in interface ConfluentAdmin
options
- The options to use for the request.@Confluent public ComputeEvenClusterLoadPlanResult computeEvenClusterLoadPlan(ComputeEvenClusterLoadPlanOptions options)
ConfluentAdmin
The following exceptions can be anticipated for when calling get()
on the futures
obtained from
the returned ComputeEvenClusterLoadPlanResult
:
ClusterAuthorizationException
If we didn't have sufficient permission to request rebalance plan. The request would not be
started.TimeoutException
If the request timed out as no response was received from the controller, possible reasons
could be request was faulted or response being dropped due to some network issue etc.
BalancerOfflineException
If the Confluent Balancer component is disabled or not started yet. Query its status with
ConfluentAdmin.describeBalancerStatus()
for more information.BalancerLoadError
If the Confluent Balancer component failed to load. Query its status with ConfluentAdmin.describeBalancerStatus()
for more information.BrokerRemovalInProgressException
If a broker removal operation is in progress.BrokerAdditionInProgressException
If a broker addition operation is in progress.EvenClusterLoadTaskInProgressException
If an even cluster load operation is in progress.BrokerFailureFixInProgressException
If there's an ongoing broker failure anomaly fix.RebalancePlanComputationException
If there's an issue with SBC's plan computation process.computeEvenClusterLoadPlan
in interface ConfluentAdmin
options
- The options to use for the request.public DescribeEvenClusterLoadStatusResult describeEvenClusterLoadStatus(DescribeEvenClusterLoadStatusOptions options)
ConfluentAdmin
get()
on the future
obtained from the returned DescribeEvenClusterLoadStatusResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.TimeoutException
If the request timed out before the controller could fetch even cluster load status.describeEvenClusterLoadStatus
in interface ConfluentAdmin
options
- The options to use when fetching the even cluster load status.@Confluent public CreateClusterLinksResult createClusterLinks(Collection<NewClusterLink> clusterLinks, CreateClusterLinksOptions options)
ConfluentAdmin
get()
on the futures obtained from
the returned CreateClusterLinksResult
:
BalancerOfflineException
If the Confluent Balancer component is disabled or not started yet. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationBalancerLoadError
If the Confluent Balancer component failed to load. Query its status with ConfluentAdmin.describeBalancerStatus()
for more informationInvalidClusterLinkException
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
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 DescribeClusterLinksResult describeClusterLinks(DescribeClusterLinksOptions options)
ConfluentAdmin
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned DescribeClusterLinksResult
:
ClusterAuthorizationException
If the authenticated user didn't have DESCRIBE
access to the cluster.NotControllerException
If the Kafka broker is not a controller.ClusterLinkDisabledException
If cluster link is disabled.TimeoutException
If the request timed out before the controller could list the cluster links.describeClusterLinks
in interface ConfluentAdmin
options
- The options to use when describing the cluster links. When no link name is provided,
all the cluster links descriptions will be returned.@Confluent public DeleteClusterLinksResult deleteClusterLinks(Collection<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(Map<String,AlterMirrorOp> 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
:
TopicAuthorizationException
If the authenticated user didn't have ALTER
access to the topic.TimeoutException
If the request timed out before the controller could complete the mirror operation.alterMirrors
in interface ConfluentAdmin
ops
- The mirror alteration operation for each topic.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(Collection<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.@Confluent public AlterLeadershipPriorityResult alterLeadershipPriority(AlterLeadershipPrioritySpec data, AlterLeadershipPriorityOptions options)
ConfluentAdmin
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned AlterLeadershipPriorityResult
:
ClusterAuthorizationException
If the authenticated user didn't have ALTER
access to the cluster.InvalidRequestException
If an invalid reason or no brokerIds are specified as request arguments.TimeoutException
If the request timed out before the controller could complete the operation.alterLeadershipPriority
in interface ConfluentAdmin
data
- The request arguments for changing leadership priority request.options
- The options to use when changing leadership priority.@Confluent public DescribeLeadershipPriorityResult describeLeadershipPriority(DescribeLeadershipPriorityOptions options)
ConfluentAdmin
The following exceptions can be anticipated when calling get()
on the futures obtained from
the returned DescribeLeadershipPriorityResult
:
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.describeLeadershipPriority
in interface ConfluentAdmin
options
- The options to use when describing leadership priority.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(Map<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.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 resultpublic UnregisterBrokerResult unregisterBroker(int brokerId, UnregisterBrokerOptions options)
Admin
This operation does not have any effect on partition assignments. It is supported
only on Kafka clusters which use Raft to store metadata, rather than ZooKeeper.
The following exceptions can be anticipated when calling get()
on the future from the
returned UnregisterBrokerResult
:
TimeoutException
If the request timed out before the describe operation could finish.UnsupportedVersionException
If the software is too old to support the unregistration API, or if the
cluster is not using Raft to store metadata.
unregisterBroker
in interface Admin
brokerId
- the broker id to unregister.options
- the options to use.UnregisterBrokerResult
containing the resultpublic DescribeProducersResult describeProducers(Collection<TopicPartition> topicPartitions, DescribeProducersOptions options)
Admin
DescribeProducersOptions.brokerId(int)
, this will
query the partition leader to find the producer state.describeProducers
in interface Admin
topicPartitions
- The set of partitions to queryoptions
- Options to control the method behaviorpublic DescribeTransactionsResult describeTransactions(Collection<String> transactionalIds, DescribeTransactionsOptions options)
Admin
describeTransactions
in interface Admin
transactionalIds
- The set of transactional IDs to queryoptions
- Options to control the method behaviorpublic AbortTransactionResult abortTransaction(AbortTransactionSpec spec, AbortTransactionOptions options)
Admin
abortTransaction
in interface Admin
spec
- The transaction specification including topic partition and producer detailsoptions
- Options to control the method behavior (including filters)public ListTransactionsResult listTransactions(ListTransactionsOptions options)
Admin
ListTransactionsOptions.filterProducerIds(Collection)
or
ListTransactionsOptions.filterStates(Collection)
listTransactions
in interface Admin
options
- Options to control the method behavior (including filters)public FenceProducersResult fenceProducers(Collection<String> transactionalIds, FenceProducersOptions options)
Admin
fenceProducers
in interface Admin
transactionalIds
- The IDs of the producers to fence.options
- The options to use when fencing the producers.