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

Compare with Current View Page History

« Previous Version 3 Next »

Status

Current stateUnder Discussion

Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]

JIRA: KAFKA-8454

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

Motivation

The Kafka AdminClient is currently an abstract class. The original motivation for using an abstract class, rather than an interface, was because Java 7 did not support default method for interfaces. Kafka now has a minimum Java version of 1.8, which does support default methods on interface.

An AdminClient interface has several advantages over an abstract base class, most notably allowing multi-inheritance and the use of dynamic proxies. The current use of an abstract base class imposes unnecessary restrictions on client code making use of the AdminClient and other libraries which accept the AdminClient. 

As an example, a project could make use of a dynamic proxy on an AdminClient interface to ensure downstream code only called read-only methods on the client.

Public Interfaces

The following changes to the public interfaces of the Kafka libraries will be made:

A new `Admin` interface will be added, (naming inline with the client interfaces `Consumer` and `Producer`). The interface will define all the methods the `AdminClient` class currently defines, with default implementations where necessary.

The existing `AdminClient` abstract class will be changed to implement the new `Admin` interface and its own implementation remove.

The existing `AdminClient` will be marked as deprecated.

All use of `AdminClient` within the Kafka project will be replaced with use of the `Admin` interface, with the exception of any classes extending the abstract class, (`KafkaAdminClient` and `MockAdminClient`), which will continue to do so to maintain backwards compatibility.

Proposed Changes

As per section above, use of the `AdminClient` abstract base class will be deprecated in favour of a new Kafka `Admin` interface.

Compatibility, Deprecation, and Migration Plan

Adding the interface and moving the default implementations of methods to the interface is a binary compatible change, so will not affect existing clients.

With the abstract `AdminClient` marked as deprecated we can look to remove it in a future major release.

Rejected Alternatives

None.

  • No labels