...
Code Block |
---|
package org.apache.kafka.connect.rest; public interface ConnectRestExtension extends Configurable, Versionedhe above approach helps alleviate any issues that could arise if Extension accidentally Versioned, Closeable { /** * ConnectRestExtension implementations register custom JAX-RS resources via the {@link * #register(ConnectRestExtensionContext)} method. Framework will invoke this method after * registering the default Connect resources. If the implementations attempt to re-register any * of the Connect Resources, it will be be ignored and will be logged. * * @param restPluginContext The context provides access to JAX-RS {@link javax.ws.rs.core.Configurable} * and {@link ConnectClusterState}.The custom JAX-RS resources can be * registered via the {@link ConnectRestExtensionContext#configurable()} */ void register(ConnectRestExtensionContext restPluginContext); } |
As mentioned above, even though the developers are required to only implement the ConnectRestExtension, they will be using several new public interfaces that are implemented by the framework.
Versioned
A new Versioned interface that will be used by all the plugins/components that support version. The Connector interface would be modified to extend this new interface instead of exposing the version() method itself.
Code Block |
---|
package org.apache.kafka.connect.components; public interface Versioned { /** * Get the version of this component. * * @return the version, formatted as a String */ String version(); } |
ConnectRestExtensionContext
This is a request Context interface that composes and provides access to
- Configurable - register JAX-RS resources
- clusterState - A new interface that helps provide some cluster state information
Code Block |
---|
package org.apache.kafka.connect.rest; interface ConnectRestExtensionContext{ /** * * @return return a implementation of {@link javax.ws.rs.core.Configurable} that be used ot * register JAX-RS resources */ Configurable<? extends Configurable> configurable(); /** * Provides meta data about connector's and its health * @return instance of {@link ConnectClusterState} */ ConnectClusterState clusterState(); } |
ConnectClusterState
This interface provides methods for the extension to get the connector states and list of running connectors.
...