You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

 

Status

Current state["Under Discussion"]

Discussion thread: TBD

JIRA: TBD

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Kafka Streams was added before the Java AdminClient was introduced (KIP-117), and hence an internal StreamsKafkaClient is added for 1) managing the internal topics and 2) check compatibility between clients and brokers.

After 1.0.0 release, there are increasing number of requests to add more functionalities to the Streams client, such as purging internal data, list consumer groups etc. In addition, we also want to consolidate such duplicated code for the same functionality. So in this KIP we are proposing to add the Java AdminClient to Kafka Streams, with the goal to eventually replace StreamsKafkaClient for administrative functionalities.

 

Note that the scope of this KIP is only for the user facing public APIs that are needed for adding this client. We are going to replace the whole StreamsKafkaClient in steps alongside with this KIP.

 

Public Interfaces

Add a new function in the org.apache.kafka.streams.KafkaClientSupplier, as the following:

import org.apache.kafka.clients.admin.AdminClient;

public interface KafkaClientSupplier {
    // other existing APIs

    /**
     * Create a {@link AdminClient} which is used for internal topic management.
     *
     * @param config Supplied by the {@link StreamsConfig} given to the {@link KafkaStreams}
     * @return an instance of {@link AdminClient}
     */
    AdminClient getAdminClient(final Map<String, Object> config);
}

 

Proposed Changes

The newly added API allows the Streams library to create an instance of AdminClient. We are going to create one instance within each thread, and pass in that instance into the created InternalTopicManager for the leader of the group only. Here are a list of changes we are going to make:

  • Purge repartition data on commit: this is summarized in  Unable to render Jira issues macro, execution error. . The AdminClient's deleteRecords API (adding in KIP-204) will be used upon committing intervals.
  • Create internal topic within InternalTopicManager: we will use the create topic API to do that, and also we'll remove the endless-loop checking after the creation within StreamsPartitionAssignor, instead after the rebalance we will let the restoration retry within the main loop if the metadata is not known yet.
  • Compatibility check: we will use a network client for this purpose, as it is a one-time thing. 

 

Compatibility, Deprecation, and Migration Plan

  • Since we are only adding a new function in the public API, it is binary compatible though not source compatible; users are only required to make one-line change and recompile if they customize the KafkaClientSupplier.

Rejected Alternatives

None

  • No labels