Search in sources :

Example 1 with ConnectRestExtension

use of org.apache.kafka.connect.rest.ConnectRestExtension in project kafka by apache.

the class RestServer method stop.

public void stop() {
    log.info("Stopping REST server");
    try {
        for (ConnectRestExtension connectRestExtension : connectRestExtensions) {
            try {
                connectRestExtension.close();
            } catch (IOException e) {
                log.warn("Error while invoking close on " + connectRestExtension.getClass(), e);
            }
        }
        jettyServer.stop();
        jettyServer.join();
    } catch (Exception e) {
        jettyServer.destroy();
        throw new ConnectException("Unable to stop REST server", e);
    }
    log.info("REST server stopped");
}
Also used : IOException(java.io.IOException) ConnectRestExtension(org.apache.kafka.connect.rest.ConnectRestExtension) IOException(java.io.IOException) ConfigException(org.apache.kafka.common.config.ConfigException) ConnectException(org.apache.kafka.connect.errors.ConnectException) ConnectException(org.apache.kafka.connect.errors.ConnectException)

Example 2 with ConnectRestExtension

use of org.apache.kafka.connect.rest.ConnectRestExtension in project kafka by apache.

the class RestServer method registerRestExtensions.

void registerRestExtensions(Herder herder, ResourceConfig resourceConfig) {
    connectRestExtensions = herder.plugins().newPlugins(config.getList(WorkerConfig.REST_EXTENSION_CLASSES_CONFIG), config, ConnectRestExtension.class);
    long herderRequestTimeoutMs = ConnectorsResource.REQUEST_TIMEOUT_MS;
    Integer rebalanceTimeoutMs = config.getRebalanceTimeout();
    if (rebalanceTimeoutMs != null) {
        herderRequestTimeoutMs = Math.min(herderRequestTimeoutMs, rebalanceTimeoutMs.longValue());
    }
    ConnectClusterDetails connectClusterDetails = new ConnectClusterDetailsImpl(herder.kafkaClusterId());
    ConnectRestExtensionContext connectRestExtensionContext = new ConnectRestExtensionContextImpl(new ConnectRestConfigurable(resourceConfig), new ConnectClusterStateImpl(herderRequestTimeoutMs, connectClusterDetails, herder));
    for (ConnectRestExtension connectRestExtension : connectRestExtensions) {
        connectRestExtension.register(connectRestExtensionContext);
    }
}
Also used : ConnectClusterDetails(org.apache.kafka.connect.health.ConnectClusterDetails) ConnectClusterStateImpl(org.apache.kafka.connect.runtime.health.ConnectClusterStateImpl) ConnectClusterDetailsImpl(org.apache.kafka.connect.runtime.health.ConnectClusterDetailsImpl) ConnectRestExtension(org.apache.kafka.connect.rest.ConnectRestExtension) ConnectRestExtensionContext(org.apache.kafka.connect.rest.ConnectRestExtensionContext)

Aggregations

ConnectRestExtension (org.apache.kafka.connect.rest.ConnectRestExtension)2 IOException (java.io.IOException)1 ConfigException (org.apache.kafka.common.config.ConfigException)1 ConnectException (org.apache.kafka.connect.errors.ConnectException)1 ConnectClusterDetails (org.apache.kafka.connect.health.ConnectClusterDetails)1 ConnectRestExtensionContext (org.apache.kafka.connect.rest.ConnectRestExtensionContext)1 ConnectClusterDetailsImpl (org.apache.kafka.connect.runtime.health.ConnectClusterDetailsImpl)1 ConnectClusterStateImpl (org.apache.kafka.connect.runtime.health.ConnectClusterStateImpl)1