Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleAdminClient API
public class AdminClient {
    
    /**
     * A client is instantiated by providing a set of key-value pairs as configuration. Most
     * of the settings will be related to NetworkClient
     *
     * @param properties settings related to Network client and at least one broker from KafkaCluster to connect to
     */
    public AdminClient(Properties properties) 
    
    /**
     * CreateInitiates topics withcreation.  a
 built (via dedicated builder) object* whichThis encapsulatesis an asynchronous call, it *returns allimmediately neededonce parametersthe forserver topichas creationaccepted request and stored respective data in zookeeper.
*
     * @returnsTo simulate a mappingsimple betweenblocking topiccall nameFuture.get andcan error code returned from the server     * 
be called. This will ensure that metadata about newly created topics was propagated
     * @throwsto ApiExceptionall brokers.
in case of global error, which*
 means topic creation was not* even@param started
createTopicRequestBody holder (built by means */
of respective Builder) of publicall Map<String,required Errors>arguments createTopics(CreateTopicRequestBody createTopicRequestBody) throws ApiException;
to create topics
         /**
 @returns java.util.concurrent.Future which holds *topics Altercreation topicsresult with- a built (via dedicated builder) object which encapsulatesmap topic-name - error code. 
     * all
 needed parameters for topic alteration* @throws ApiException in case *
of global error, which means topic *creation @returnswas anot mappingeven betweenstarted
 topic name and error code*/
 returned from the serverpublic Future<Map<String, Errors>> createTopics(CreateTopicRequestBody createTopicRequestBody) *throws ApiException;
    
 * @throws ApiException in/**
 case of global error, which* meansInitiates topictopics alteration. was not even started
     */ 
     * This is an asynchronous call, it returns immediately once the server has accepted request and stored/changed respective data in zookeeper.
    public Map<String, Errors> alterTopics(AlterTopicRequestBody alterTopicRequestBody) throws ApiException;
    
 * To simulate a simple blocking call Future.get can be called. This will ensure that updated metadata about altered topics was propagated
     * to all brokers.
     *
     * @param alterTopicRequestBody holder (built by means of respective Builder) of all required arguments to alter topics
     * @returns java.util.concurrent.Future which holds topics alteration result - a map topic-name - error code. 
     * 
     * @throws ApiException in case of global error, which means topic creation was not even started
     */
    public Future<Map<String, Errors>> alterTopics(AlterTopicRequestBody alterTopicRequestBody) throws ApiException;
    
    /**
     * Initiates topic alteration.
     * This is an asynchronous call, it returns immediately once server has accepted request and marked requested topics for deletion in zookeeper.
     * To simulate a simple blocking call Future.get can be called. This will ensure that metadata with updated topic list was propagated to 
     * all brokers.    /**
     * Delete Kafka topics by name
     *
     * @returns a mapping between topic name and error code returned from the server @param topics topic names to be deleted
     * @returns java.util.concurrent.Future which holds topics
     *
     * @throws ApiException in case of global error, which means topic deletion was not even started
     */
    public Map <StringFuture<Map<String, Errors>Errors>> deleteTopics(List<String> topics) throws ApiException;
    
    /**
     * List all existing topics in Kafka cluster
     *
     * @returns list of topic names
     *
     * @throws ApiException
     */
    public List<String> listTopics() throws ApiException;
 
    /**
     * Check whether topic with the given name exists
     *
     * @throws ApiException
     */
    public boolean topicExists(String topicName) throws ApiException;
    
    /**
     * Request replication information about Kafka topics
     * 
     * @returns a mapping between topic name and topic description
     * @throws ApiException in case of global error, which means topic description cannot be fetched for all topics
     */
    public Map<String, DescribeTopicOutput> describeTopics(List<String> topicNames) throws ApiException;
    
    /**
     * Initiate long-running reassign partitions procedure
     *
     * @param partitionsReassignment manual partitions assignment string (according to ReassignPartitionsCommand)
     * @return future of the reassignment result which is completed once server-side partitions reassignment has succeeded or
     * an error occurred so that partitions reassignment cannot be started
     * @throws ApiException in case partition reassignment wasn't initiated on server
     */
    public Future<ReassignPartitionsResponse> reassignPartitions(String partitionsReassignment) throws ApiException;

    /**
     * Check the interim status of the partitions reassignment
     *
     * @param partitionsReassignment manual partitions assignment string (according to ReassignPartitionsCommand)
     * @return partition to reassignment result code (completed, in-progress, failed)
     * @throws ApiException in case reassignment verification wasn't initiated on server
     */
    public Map<TopicPartition, Short> verifyReassignPartitions(String partitionsReassignment) throws ApiException;
    
    /**
     * Initiate long-running preferred replica leader election procedure
     *
     * @param partitions serialized partitions for which preferred replica leader election will be started
     *                   (according to PreferredReplicaLeaderElectionCommand)
     * @return future of the election result which is completed once server-side preferred replica is elected for provided partitions or
     * an error has occurred
     * @throws ApiException in case preferred replica procedure wasn't initiated on server
     */
    public Future<PreferredReplicaLeaderElectionResponse> preferredReplicaLeaderElection(String partitions) throws ApiException;

    /**
     * Check the interim status of the preferred replica leader election
     *
     * @param partitions for which preferred replica leader election was started (according to PreferredReplicaLeaderElectionCommand)
     * @return partition to reassignment result code (completed, in-progress, failed)
     * @throws ApiException in case procedure verification wasn't started on server
     */
    public VerifyPreferredReplicaLeaderElectionResponse verifyPreferredReplicaLeaderElection(String partitions)
            throws ApiException;
}

...