Interface ConnectRestExtension
- All Superinterfaces:
AutoCloseable,Closeable,org.apache.kafka.common.Configurable,Versioned
ServiceLoader mechanism by Connect's plugin class loading mechanism. Kafka Connect discovers implementations of this interface using the Java ServiceLoader mechanism. To support this, implementations of this interface should also contain a service provider configuration file in META-INF/services/org.apache.kafka.connect.rest.ConnectRestExtension.
The extension class(es) must be packaged as a plugin, including the JARs of all dependencies except those already provided by the Connect framework.
To install into a Connect installation, add a directory named for the plugin and containing the plugin's JARs into a directory that is on Connect's plugin.path, and (re)start the Connect worker.
When the Connect worker process starts up, it will read its configuration and instantiate all of the REST extension implementation classes that are specified in the `rest.extension.classes` configuration property. Connect will then pass its configuration to each extension via the Configurable.configure(Map) method, and will then call register(org.apache.kafka.connect.rest.ConnectRestExtensionContext) with a provided context.
When the Connect worker shuts down, it will call the extension's Closeable.close() method to allow the implementation to release all of its resources.
Implement Monitorable to enable the extension to register metrics. The following tags are automatically added to all metrics registered: config set to rest.extension.classes, and class set to the ConnectRestExtension class name.
Method Summary
Modifier and TypeMethodDescriptionvoidregister(ConnectRestExtensionContext restPluginContext) ConnectRestExtension implementations can register custom JAX-RS resources via this method.Methods inherited from interface org.apache.kafka.common.Configurable
configure
Method Details
register
ConnectRestExtension implementations can register custom JAX-RS resources via this method. The Connect 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 ignored and will be logged.- Parameters:
restPluginContext- The context provides access to JAX-RSConfigurableandConnectClusterState.The custom JAX-RS resources can be registered via theConnectRestExtensionContext.configurable()