Status
Current state: Under Discussion Accepted
Discussion thread: here
JIRA: here
...
| Code Block |
|---|
|
package org.apache.kafka.connect.components;
import org.apache.kafka.common.config.ConfigDef;
/**
* Interface for components that provide version and configuration specifications.
* This interface establishes a common contract for all Kafka Connect components
* that define a versin and expose configurable properties, enabling uniform discovery and introspection
* of component configurations.
*
* <p>Components implementing this interface declare their version and configuration requirements
* through a {@link ConfigDef} object, which describes the configuration properties
* including their names, types, default values, validators, and documentation.
*
*/
public interface ConnectPlugin extends Versioned {
/**
* GetReturns the versionconfiguration specification offor this component.
*
*
<p>The returned {@link *ConfigDef} @returnobject thedescribes version,all formattedconfiguration asproperties a String. The version may not be {@code null} or empty.
*/
String version();
/*
* that this component accepts, including their types, default values, validators,
* importance levels, and documentation strings.
*
* Returns@return the configuration specificationdefinition for this component.; never null
*/
* <p>The returned {@link ConfigDef} object describes all configuration properties
* that this component accepts, including their types, default values, validators,
* importance levels, and documentation strings.
*
* @return the configuration definition for this component; never null
ConfigDef config();
} |
The following existing interfaces will be modified to implement/extend ConnectorPlugin:
| Code Block |
|---|
| language | java |
|---|
| title | Connector |
|---|
|
public abstract class Connector implements ConnectPlugin {
/**
* Define the configuration for the connector.
* @return The ConfigDef for this connector; may not be null.
*/
@Override
public abstract ConfigDef config();
} |
The following existing interfaces will be modified to implement/extend ConnectorPlugin:
| Code Block |
|---|
| Code Block |
|---|
| language | java |
|---|
| title | Connector |
|---|
|
public abstract class Connector implements ConnectPlugin {
/**
* Define the configuration for the connector.
* @return The ConfigDef for this connector; may not be null.
*/
@Override
public abstract ConfigDef config();
} |
|
public interface Converter extends Closeable, ConnectPlugin {
/**
* Configuration specification for this converter.
* @return the configuration specification; may not be null
*/
@Override
default ConfigDef config() { return new ConfigDef();}
/**
* Get the version of this component.
*
* @return the version, formatted as a String. The version may not be {@code null} or empty.
*/
@Override
default String version() {
return "undefined";
}
} |
| Code Block |
|---|
| language | java |
|---|
| title | HeaderConverter |
|---|
|
public interface HeaderConverter extends Configurable, Closeable, ConnectPlugin {
/**
* Configuration specification for this set of header converters.
* @return the configuration specification; may not be null
*/
@Override
ConfigDef config();
/**
* Get the version of this component.
*
* @return the version, formatted as a String. The version may not be {@code null} or empty.
*/
@Override
default String version() {
return "undefined";
}
}
|
| Code Block |
|---|
| language | java |
|---|
| title | Transformation |
|---|
|
public interface Transformation<R extends ConnectRecord<R>> extends Configurable, Closeable, ConnectPlugin {
/** Configuration specification for this transformation.
*/
@Override
ConfigDef config();
/**
* Get the version of this component.
*
* @return the version, formatted as a String. The version may not be {@code null} or empty.
*/
@Override
default String version() {
return "undefined";
|
| Code Block |
|---|
| language | java |
|---|
| title | Converter |
|---|
|
public interface Converter extends Closeable, ConnectPlugin {
/**
* Configuration specification for this converter.
* @return the configuration specification; may not be null
*/
@Override
default ConfigDef config() { return new ConfigDef();}
} |
| Code Block |
|---|
| language | java |
|---|
| title | HeaderConverterPredicate |
|---|
|
public interface HeaderConverterPredicate<R extends ConnectRecord<R>> extends Configurable, CloseableAutoCloseable, ConnectPlugin {
/**
* Configuration specification for this setpredicate. of header converters.
* @return the configuration specification; may not be null
*/
@Override
ConfigDef config();
}
|
| Code Block |
|---|
| language | java |
|---|
| title | Transformation |
|---|
|
public interface Transformation<R extends ConnectRecord<R>> extends Configurable, Closeable, ConnectPlugin {
* @return the configuration definition for this predicate; never null
*/** Configuration specification for this transformation.
@Override
*/ConfigDef config();
@Override
ConfigDef config();
} |
| Code Block |
|---|
| language | java |
|---|
| title | Predicate |
|---|
|
public interface Predicate<R extends ConnectRecord<R>> extends Configurable, AutoCloseable, ConnectPlugin {
/**
* Configuration specification for this predicate.
*
* @return the configuration definition for this predicate; never null
*/
@Override
ConfigDef config();/**
* Get the version of this component.
*
* @return the version, formatted as a String. The version may not be {@code null} or empty.
*/
@Override
default String version() {
return "undefined";
}
} |
Other interfaces like ConnectRestExtension and ConnectorClientConfigOverridePolicy, even if they currently don't declare a config() method, since they implement the Configurable, we can think of adding the ConnectPlugin for future use in this way
...