Search in sources :

Example 1 with SinkConnector

use of org.apache.kafka.connect.sink.SinkConnector in project connect-utils by jcustenborder.

the class BaseDocumentationTest method before.

@BeforeEach
public void before() throws MalformedURLException {
    log.info("before() - Configuring reflections to use package '{}'", packages());
    if (null == this.reflections) {
        this.reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forJavaClassPath()).forPackages(packages()));
    }
    this.packages = ImmutableSet.copyOf(packages());
    List<Class<? extends Transformation>> transformClasses = list(Transformation.class);
    List<Class<? extends SourceConnector>> sourceConnectorClasses = list(SourceConnector.class);
    List<Class<? extends SinkConnector>> sinkConnectorClasses = list(SinkConnector.class);
    this.pluginTemplate = PluginTemplate.from(sourceConnectorClasses, sinkConnectorClasses, transformClasses);
}
Also used : SourceConnector(org.apache.kafka.connect.source.SourceConnector) ConfigurationBuilder(org.reflections.util.ConfigurationBuilder) SinkConnector(org.apache.kafka.connect.sink.SinkConnector) Transformation(org.apache.kafka.connect.transforms.Transformation) Reflections(org.reflections.Reflections) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with SinkConnector

use of org.apache.kafka.connect.sink.SinkConnector in project apache-kafka-on-k8s by banzaicloud.

the class DistributedHerder method validateBasicConnectorConfig.

@Override
protected Map<String, ConfigValue> validateBasicConnectorConfig(Connector connector, ConfigDef configDef, Map<String, String> config) {
    Map<String, ConfigValue> validatedConfig = super.validateBasicConnectorConfig(connector, configDef, config);
    if (connector instanceof SinkConnector) {
        ConfigValue validatedName = validatedConfig.get(ConnectorConfig.NAME_CONFIG);
        String name = (String) validatedName.value();
        if (workerGroupId.equals(SinkUtils.consumerGroupId(name))) {
            validatedName.addErrorMessage("Consumer group for sink connector named " + name + " conflicts with Connect worker group " + workerGroupId);
        }
    }
    return validatedConfig;
}
Also used : SinkConnector(org.apache.kafka.connect.sink.SinkConnector) ConfigValue(org.apache.kafka.common.config.ConfigValue)

Example 3 with SinkConnector

use of org.apache.kafka.connect.sink.SinkConnector in project kafka by apache.

the class DistributedHerder method validateBasicConnectorConfig.

@Override
protected Map<String, ConfigValue> validateBasicConnectorConfig(Connector connector, ConfigDef configDef, Map<String, String> config) {
    Map<String, ConfigValue> validatedConfig = super.validateBasicConnectorConfig(connector, configDef, config);
    if (connector instanceof SinkConnector) {
        ConfigValue validatedName = validatedConfig.get(ConnectorConfig.NAME_CONFIG);
        String name = (String) validatedName.value();
        if (workerGroupId.equals(SinkUtils.consumerGroupId(name))) {
            validatedName.addErrorMessage("Consumer group for sink connector named " + name + " conflicts with Connect worker group " + workerGroupId);
        }
    }
    return validatedConfig;
}
Also used : SinkConnector(org.apache.kafka.connect.sink.SinkConnector) ConfigValue(org.apache.kafka.common.config.ConfigValue)

Aggregations

SinkConnector (org.apache.kafka.connect.sink.SinkConnector)3 ConfigValue (org.apache.kafka.common.config.ConfigValue)2 SourceConnector (org.apache.kafka.connect.source.SourceConnector)1 Transformation (org.apache.kafka.connect.transforms.Transformation)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Reflections (org.reflections.Reflections)1 ConfigurationBuilder (org.reflections.util.ConfigurationBuilder)1