- Kafka admin client java
- Method Summary
- Methods inherited from class org.apache.kafka.clients.admin.AdminClient
- Methods inherited from class java.lang.Object
- Method Detail
- close
- createTopics
- deleteTopics
- listTopics
- describeTopics
- describeCluster
- describeAcls
- createAcls
- deleteAcls
- describeConfigs
- alterConfigs
- alterReplicaLogDirs
- describeLogDirs
- describeReplicaLogDirs
- createPartitions
- deleteRecords
- createDelegationToken
- renewDelegationToken
- expireDelegationToken
- describeDelegationToken
- describeConsumerGroups
- listConsumerGroups
- listConsumerGroupOffsets
- deleteConsumerGroups
Kafka admin client java
The default implementation of AdminClient . An instance of this class is created by invoking one of the create() methods in AdminClient . Users should not refer to this class directly. The API of this class is evolving, see AdminClient for details.
Method Summary
Increase the number of partitions of the topics given as the keys of newPartitions according to the corresponding values.
Query the information of all log directories on the given set of brokers This operation is supported by brokers with version 1.0.0 or higher.
Methods inherited from class org.apache.kafka.clients.admin.AdminClient
Methods inherited from class java.lang.Object
Method Detail
close
public void close(long duration, java.util.concurrent.TimeUnit unit)
Close the AdminClient and release all associated resources. The close operation has a grace period during which current operations will be allowed to complete, specified by the given duration and time unit. New operations will not be accepted during the grace period. Once the grace period is over, all operations that have not yet been completed will be aborted with a TimeoutException.
createTopics
public CreateTopicsResult createTopics(java.util.CollectionNewTopic> newTopics, CreateTopicsOptions options)
Create a batch of new topics. This operation is not transactional so it may succeed for some topics while fail for others. It may take several seconds after CreateTopicsResult returns success for all the brokers to become aware that the topics have been created. During this time, AdminClient.listTopics() and AdminClient.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.
deleteTopics
public DeleteTopicsResult deleteTopics(java.util.Collection topicNames, DeleteTopicsOptions options)
Delete a batch of topics. This operation is not transactional so it may succeed for some topics while fail for others. It may take several seconds after the DeleteTopicsResult returns success for all the brokers to become aware that the topics are gone. During this time, AdminClient#listTopics and AdminClient#describeTopics 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.
listTopics
public ListTopicsResult listTopics(ListTopicsOptions options)
describeTopics
public DescribeTopicsResult describeTopics(java.util.Collection topicNames, DescribeTopicsOptions options)
describeCluster
public DescribeClusterResult describeCluster(DescribeClusterOptions options)
describeAcls
public DescribeAclsResult describeAcls(AclBindingFilter filter, DescribeAclsOptions options)
Lists access control lists (ACLs) according to the supplied filter. 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.
createAcls
public CreateAclsResult createAcls(java.util.CollectionAclBinding> acls, CreateAclsOptions options)
Creates access control lists (ACLs) which are bound to specific resources. This operation is not transactional so it may succeed for some ACLs while fail for others. If you attempt to add an ACL that duplicates an existing ACL, no error will be raised, but no changes will be made. This operation is supported by brokers with version 0.11.0.0 or higher.
deleteAcls
public DeleteAclsResult deleteAcls(java.util.CollectionAclBindingFilter> filters, DeleteAclsOptions options)
Deletes access control lists (ACLs) according to the supplied filters. This operation is not transactional so it may succeed for some ACLs while fail for others. This operation is supported by brokers with version 0.11.0.0 or higher.
describeConfigs
public DescribeConfigsResult describeConfigs(java.util.CollectionConfigResource> configResources, DescribeConfigsOptions options)
Get the configuration for the specified resources. The returned configuration includes default values and the isDefault() method can be used to distinguish them from user supplied values. The value of config entries where isSensitive() is true is always null so that sensitive information is not disclosed. Config entries where isReadOnly() is true cannot be updated. This operation is supported by brokers with version 0.11.0.0 or higher.
alterConfigs
public AlterConfigsResult alterConfigs(java.util.MapConfigResource,Config> configs, AlterConfigsOptions options)
Update the configuration for the specified resources with the default options. Updates are not transactional so they may succeed for some resources while fail for others. The configs for a particular resource are updated atomically. This operation is supported by brokers with version 0.11.0.0 or higher.
alterReplicaLogDirs
public AlterReplicaLogDirsResult alterReplicaLogDirs(java.util.MapTopicPartitionReplica,java.lang.String> replicaAssignment, AlterReplicaLogDirsOptions options)
Change the log directory for the specified replicas. This API is currently only useful if it is used before the replica has been created on the broker. It will support moving replicas that have already been created after KIP-113 is fully implemented. 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.0.0 or higher.
describeLogDirs
public DescribeLogDirsResult describeLogDirs(java.util.Collection brokers, DescribeLogDirsOptions options)
Query the information of all log directories on the given set of brokers This operation is supported by brokers with version 1.0.0 or higher.
describeReplicaLogDirs
public DescribeReplicaLogDirsResult describeReplicaLogDirs(java.util.CollectionTopicPartitionReplica> replicas, DescribeReplicaLogDirsOptions options)
Query the replica log directory information for the specified replicas. This operation is supported by brokers with version 1.0.0 or higher.
createPartitions
public CreatePartitionsResult createPartitions(java.util.MapNewPartitions> newPartitions, CreatePartitionsOptions options)
- AuthorizationException if the authenticated user is not authorized to alter the topic
- TimeoutException if the request was not completed in within the given AbstractOptions.timeoutMs() .
- ReassignmentInProgressException if a partition reassignment is currently in progress
- BrokerNotAvailableException 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.
- Subclasses of KafkaException if the request is invalid in some way.
deleteRecords
public DeleteRecordsResult deleteRecords(java.util.MapTopicPartition,RecordsToDelete> recordsToDelete, DeleteRecordsOptions options)
Delete records whose offset is smaller than the given offset of the corresponding partition. This operation is supported by brokers with version 0.11.0.0 or higher.
createDelegationToken
public CreateDelegationTokenResult createDelegationToken(CreateDelegationTokenOptions options)
- 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() .
renewDelegationToken
public RenewDelegationTokenResult renewDelegationToken(byte[] hmac, RenewDelegationTokenOptions options)
- 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() .
expireDelegationToken
public ExpireDelegationTokenResult expireDelegationToken(byte[] hmac, ExpireDelegationTokenOptions options)
- 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() .
describeDelegationToken
public DescribeDelegationTokenResult describeDelegationToken(DescribeDelegationTokenOptions options)
- 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() .
describeConsumerGroups
public DescribeConsumerGroupsResult describeConsumerGroups(java.util.Collection groupIds, DescribeConsumerGroupsOptions options)
listConsumerGroups
public ListConsumerGroupsResult listConsumerGroups(ListConsumerGroupsOptions options)
listConsumerGroupOffsets
public ListConsumerGroupOffsetsResult listConsumerGroupOffsets(java.lang.String groupId, ListConsumerGroupOffsetsOptions options)
deleteConsumerGroups
public DeleteConsumerGroupsResult deleteConsumerGroups(java.util.Collection groupIds, DeleteConsumerGroupsOptions options)