Search in sources :

Example 21 with ConfigDef

use of org.apache.kafka.common.config.ConfigDef in project debezium by debezium.

the class PostgresConnectorConfig method configDef.

protected static ConfigDef configDef() {
    ConfigDef config = new ConfigDef();
    Field.group(config, "Postgres", SLOT_NAME, PLUGIN_NAME, SERVER_NAME, DATABASE_NAME, HOSTNAME, PORT, USER, PASSWORD, SSL_MODE, SSL_CLIENT_CERT, SSL_CLIENT_KEY_PASSWORD, SSL_ROOT_CERT, SSL_CLIENT_KEY, DROP_SLOT_ON_STOP, SSL_SOCKET_FACTORY, STATUS_UPDATE_INTERVAL_MS, TCP_KEEPALIVE);
    Field.group(config, "Events", SCHEMA_WHITELIST, SCHEMA_BLACKLIST, TABLE_WHITELIST, TABLE_BLACKLIST, COLUMN_BLACKLIST, INCLUDE_UNKNOWN_DATATYPES, SNAPSHOT_SELECT_STATEMENT_OVERRIDES_BY_TABLE, CommonConnectorConfig.TOMBSTONES_ON_DELETE);
    Field.group(config, "Connector", TOPIC_SELECTION_STRATEGY, CommonConnectorConfig.POLL_INTERVAL_MS, CommonConnectorConfig.MAX_BATCH_SIZE, CommonConnectorConfig.MAX_QUEUE_SIZE, SNAPSHOT_MODE, SNAPSHOT_LOCK_TIMEOUT_MS, TIME_PRECISION_MODE, DECIMAL_HANDLING_MODE, ROWS_FETCH_SIZE);
    return config;
}
Also used : ConfigDef(org.apache.kafka.common.config.ConfigDef)

Example 22 with ConfigDef

use of org.apache.kafka.common.config.ConfigDef in project debezium by debezium.

the class MongoDbConnectorTest method assertConfigDefIsValid.

protected static void assertConfigDefIsValid(Connector connector, io.debezium.config.Field.Set fields) {
    ConfigDef configDef = connector.config();
    assertThat(configDef).isNotNull();
    fields.forEach(expected -> {
        assertThat(configDef.names()).contains(expected.name());
        ConfigKey key = configDef.configKeys().get(expected.name());
        assertThat(key).isNotNull();
        assertThat(key.name).isEqualTo(expected.name());
        assertThat(key.displayName).isEqualTo(expected.displayName());
        assertThat(key.importance).isEqualTo(expected.importance());
        assertThat(key.documentation).isEqualTo(expected.description());
        assertThat(key.type).isEqualTo(expected.type());
        assertThat(key.defaultValue).isEqualTo(expected.defaultValue());
        assertThat(key.dependents).isEqualTo(expected.dependents());
        assertThat(key.width).isNotNull();
        assertThat(key.group).isNotNull();
        assertThat(key.orderInGroup).isGreaterThan(0);
        assertThat(key.validator).isNull();
        assertThat(key.recommender).isNull();
    });
}
Also used : ConfigKey(org.apache.kafka.common.config.ConfigDef.ConfigKey) ConfigDef(org.apache.kafka.common.config.ConfigDef)

Example 23 with ConfigDef

use of org.apache.kafka.common.config.ConfigDef in project debezium by debezium.

the class MongoDbConnectorConfig method configDef.

protected static ConfigDef configDef() {
    ConfigDef config = new ConfigDef();
    Field.group(config, "MongoDB", HOSTS, USER, PASSWORD, LOGICAL_NAME, CONNECT_BACKOFF_INITIAL_DELAY_MS, CONNECT_BACKOFF_MAX_DELAY_MS, MAX_FAILED_CONNECTIONS, AUTO_DISCOVER_MEMBERS, SSL_ENABLED, SSL_ALLOW_INVALID_HOSTNAMES);
    Field.group(config, "Events", DATABASE_WHITELIST, DATABASE_BLACKLIST, COLLECTION_WHITELIST, COLLECTION_BLACKLIST, CommonConnectorConfig.TOMBSTONES_ON_DELETE);
    Field.group(config, "Connector", MAX_COPY_THREADS, CommonConnectorConfig.MAX_QUEUE_SIZE, CommonConnectorConfig.MAX_BATCH_SIZE, CommonConnectorConfig.POLL_INTERVAL_MS);
    return config;
}
Also used : ConfigDef(org.apache.kafka.common.config.ConfigDef)

Example 24 with ConfigDef

use of org.apache.kafka.common.config.ConfigDef in project kafka by apache.

the class SourceConnectorConfig method embedDefaultGroup.

public static ConfigDef embedDefaultGroup(ConfigDef baseConfigDef) {
    String defaultGroup = "default";
    ConfigDef newDefaultDef = new ConfigDef(baseConfigDef);
    newDefaultDef.embed(DEFAULT_TOPIC_CREATION_PREFIX, defaultGroup, 0, TopicCreationConfig.defaultGroupConfigDef());
    return newDefaultDef;
}
Also used : ConfigDef(org.apache.kafka.common.config.ConfigDef)

Example 25 with ConfigDef

use of org.apache.kafka.common.config.ConfigDef in project kafka by apache.

the class SourceConnectorConfig method enrich.

/**
 * Returns an enriched {@link ConfigDef} building upon the {@code ConfigDef}, using the current configuration specified in {@code props} as an input.
 *
 * @param baseConfigDef the base configuration definition to be enriched
 * @param props the non parsed configuration properties
 * @return the enriched configuration definition
 */
public static ConfigDef enrich(ConfigDef baseConfigDef, Map<String, String> props, AbstractConfig defaultGroupConfig) {
    List<Object> topicCreationGroups = new ArrayList<>();
    Object aliases = ConfigDef.parseType(TOPIC_CREATION_GROUPS_CONFIG, props.get(TOPIC_CREATION_GROUPS_CONFIG), ConfigDef.Type.LIST);
    if (aliases instanceof List) {
        topicCreationGroups.addAll((List<?>) aliases);
    }
    ConfigDef newDef = new ConfigDef(baseConfigDef);
    String defaultGroupPrefix = TOPIC_CREATION_PREFIX + DEFAULT_TOPIC_CREATION_GROUP + ".";
    short defaultGroupReplicationFactor = defaultGroupConfig.getShort(defaultGroupPrefix + REPLICATION_FACTOR_CONFIG);
    int defaultGroupPartitions = defaultGroupConfig.getInt(defaultGroupPrefix + PARTITIONS_CONFIG);
    topicCreationGroups.stream().distinct().forEach(group -> {
        if (!(group instanceof String)) {
            throw new ConfigException("Item in " + TOPIC_CREATION_GROUPS_CONFIG + " property is not of type String");
        }
        String alias = (String) group;
        String prefix = TOPIC_CREATION_PREFIX + alias + ".";
        String configGroup = TOPIC_CREATION_GROUP + ": " + alias;
        newDef.embed(prefix, configGroup, 0, TopicCreationConfig.configDef(configGroup, defaultGroupReplicationFactor, defaultGroupPartitions));
    });
    return newDef;
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ConfigException(org.apache.kafka.common.config.ConfigException) ConfigDef(org.apache.kafka.common.config.ConfigDef)

Aggregations

ConfigDef (org.apache.kafka.common.config.ConfigDef)69 Config (org.apache.kafka.common.config.Config)29 Test (org.junit.Test)28 Connector (org.apache.kafka.connect.connector.Connector)27 SourceConnector (org.apache.kafka.connect.source.SourceConnector)26 ConnectorConfig (org.apache.kafka.connect.runtime.ConnectorConfig)24 SinkConnector (org.apache.kafka.connect.sink.SinkConnector)23 HashMap (java.util.HashMap)20 ConfigValue (org.apache.kafka.common.config.ConfigValue)19 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)19 TaskConfig (org.apache.kafka.connect.runtime.TaskConfig)17 Map (java.util.Map)14 SinkConnectorConfig (org.apache.kafka.connect.runtime.SinkConnectorConfig)14 WorkerConfig (org.apache.kafka.connect.runtime.WorkerConfig)13 List (java.util.List)12 ArrayList (java.util.ArrayList)10 Herder (org.apache.kafka.connect.runtime.Herder)10 ConnectorInfo (org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo)10 BadRequestException (org.apache.kafka.connect.runtime.rest.errors.BadRequestException)10 AbstractConfig (org.apache.kafka.common.config.AbstractConfig)9