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

Compare with Current View Page History

« Previous Version 9 Next »

This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.

Status

Current state: Under Discussion

Discussion thread: here

JIRA: here [Change the link from KAFKA-1 to your own ticket]

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

Motivation

When starting a connector, users must provide the connector configuration. The configuration often also includes configurations for other plugins such as SMTs or converters. Today, Connect does not provide a way to see what plugins are available apart from connectors (via the /connector-plugins endpoint). This make it difficult for users building data pipeline to know which plugins are available and what is possible. Basically they have to know how the Connect runtime is set up. Even once they know the plugins that are available, they then have to go look at the plugins documentation or, in the worst case, look directly at the source code to find their configuration definitions.

All plugins that are directly usable should be discoverable via the REST API. Their configuration definitions should also be easily retrieved. This would significantly ease the process of building pipelines and enable building tools and UIs that can manage Connect data pipelines.

Public Interfaces

The proposal is to add 2 new endpoints to address these limitations:

  • /plugins: This will return all plugins that are Connectors, Transformations, Converters, HeaderConverters and Predicates. Plugins will be grouped by plugin type.
{
  "converter": [
    {
      "class": "org.apache.kafka.connect.converters.ByteArrayConverter",
      "location": "classpath"
    }
  ],
  "header_converter": [
    {
      "class": "org.apache.kafka.connect.storage.SimpleHeaderConverter",
      "location": "classpath"
    }
  ],
  "sink": [
    {
      "class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
      "location": "classpath"
    }
  ],
  "source": [
    {
      "class": "org.apache.kafka.connect.file.FileStreamSourceConnector",
      "location": "classpath",
      "version": "3.0.0"
    }
  ],   
  "transformation": [
    {
      "class": "com.github.jcustenborder.kafka.connect.transform.common.BytesToString$Key",
      "location": "file:/Users/mickael/tmp/path2/kafka-connect-transform-common-0.1.0.14.jar"
    },
    {
      "class": "org.apache.kafka.connect.transforms.DropHeaders",
      "location": "classpath"
    }
  ],
  "predicate": [
     {
      "class": "org.apache.kafka.connect.transforms.predicates.HasHeaderKey",
      "location": "classpath"
    }
  ] 
}
  • /plugins/<type>/<name>/configdef: This will return the configdef for the specified plugin. Type can be either sink, source, transformation, predicate, converter or header_converter. Name must be a class name (fully qualified or not) or the Connect alias (class name without the Connector, Converter or Transform suffix) of the plugin.

For example, accessing http://localhost:8083/plugins/transformation/org.apache.kafka.connect.transforms.Cast$Value/configdef will return:

[
  {
    "name": "spec",
    "type": "LIST",
    "required": true,
    "default_value": null,
    "importance": "HIGH",
    "documentation": "List of fields and the type to cast them to of the form field1:type,field2:type to cast fields of Maps or Structs. A single type to cast the entire value. Valid types are int8, int16, int32, int64, float32, float64, boolean, and string. Note that binary fields can only be cast to string.",
    "group": null,
    "width": "NONE",
    "display_name": "spec",
    "dependents": [],
    "order": -1
  }
]

This will reuse the ConfigKeyInfo entity which is already exposed via PUT /connector-plugins/{connector-type}/config/validate.

Proposed Changes

REST API:

A new REST resource named PluginsResource will be defined and it will expose the following 2 endpoints under /plugins:

@GET
@Path("/")
public Map<String, List<PluginInfo>> listPlugins() {
    return doListPlugins();
}

@GET
@Path("/{type}/{plugin}/configdef")
public List<ConfigKeyInfo> getConnectorConfigDef(final @PathParam("type") String type, final @PathParam("plugin") String plugin) {
    return doGetConfigDef(type, plugin);
}


Converter interface:

Add a config() method to Converter. Also make it Configurable and Closeable so it's uniform with the other plugins:

public interface Converter extends Configurable, Closeable {

[...]

    /**
     * Configuration specification for this set of converters.
     * @return the configuration specification; may not be null
     */
    ConfigDef config();
}

Compatibility, Deprecation, and Migration Plan

This KIP is proposing new endpoints, existing endpoints are not changed.

Rejected Alternatives

  • Support listing worker plugins: It's unclear how useful worker plugins are for users creating connectors. I decided to focus the KIP on user plugins instead.
  • No labels