Search in sources :

Example 6 with AbstractConfig

use of org.apache.kafka.common.config.AbstractConfig in project kafka-connect-storage-cloud by confluentinc.

the class AwsAssumeRoleCredentialsProvider method configure.

@Override
public void configure(Map<String, ?> configs) {
    AbstractConfig config = new AbstractConfig(STS_CONFIG_DEF, configs);
    roleArn = config.getString(ROLE_ARN_CONFIG);
    roleExternalId = config.getString(ROLE_EXTERNAL_ID_CONFIG);
    roleSessionName = config.getString(ROLE_SESSION_NAME_CONFIG);
}
Also used : AbstractConfig(org.apache.kafka.common.config.AbstractConfig)

Example 7 with AbstractConfig

use of org.apache.kafka.common.config.AbstractConfig in project kafka-connect-hdfs by confluentinc.

the class HdfsSinkConnectorConfig method plainValues.

public Map<String, ?> plainValues() {
    Map<String, Object> map = new HashMap<>();
    for (AbstractConfig config : allConfigs) {
        map.putAll(config.values());
    }
    // Include any additional properties not defined by the ConfigDef
    // that custom partitioners might need
    Map<String, ?> originals = originals();
    for (String originalKey : originals.keySet()) {
        if (!map.containsKey(originalKey)) {
            map.put(originalKey, originals.get(originalKey));
        }
    }
    return map;
}
Also used : AbstractConfig(org.apache.kafka.common.config.AbstractConfig) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Example 8 with AbstractConfig

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

the class StreamsKafkaClientTest method testConfigFromStreamsConfig.

@Test
public void testConfigFromStreamsConfig() {
    for (final String expectedMechanism : asList("PLAIN", "SCRAM-SHA-512")) {
        final Properties props = new Properties();
        props.setProperty(StreamsConfig.APPLICATION_ID_CONFIG, "some_app_id");
        props.setProperty(SaslConfigs.SASL_MECHANISM, expectedMechanism);
        props.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9000");
        final StreamsConfig streamsConfig = new StreamsConfig(props);
        final AbstractConfig config = StreamsKafkaClient.Config.fromStreamsConfig(streamsConfig);
        assertEquals(expectedMechanism, config.values().get(SaslConfigs.SASL_MECHANISM));
        assertEquals(expectedMechanism, config.getString(SaslConfigs.SASL_MECHANISM));
    }
}
Also used : AbstractConfig(org.apache.kafka.common.config.AbstractConfig) Properties(java.util.Properties) StreamsConfig(org.apache.kafka.streams.StreamsConfig) Test(org.junit.Test)

Example 9 with AbstractConfig

use of org.apache.kafka.common.config.AbstractConfig in project apache-kafka-on-k8s by banzaicloud.

the class FileStreamSinkConnector method start.

@Override
public void start(Map<String, String> props) {
    AbstractConfig parsedConfig = new AbstractConfig(CONFIG_DEF, props);
    filename = parsedConfig.getString(FILE_CONFIG);
}
Also used : AbstractConfig(org.apache.kafka.common.config.AbstractConfig)

Example 10 with AbstractConfig

use of org.apache.kafka.common.config.AbstractConfig in project apache-kafka-on-k8s by banzaicloud.

the class FileStreamSourceConnector method start.

@Override
public void start(Map<String, String> props) {
    AbstractConfig parsedConfig = new AbstractConfig(CONFIG_DEF, props);
    filename = parsedConfig.getString(FILE_CONFIG);
    List<String> topics = parsedConfig.getList(TOPIC_CONFIG);
    if (topics.size() != 1) {
        throw new ConfigException("'topic' in FileStreamSourceConnector configuration requires definition of a single topic");
    }
    topic = topics.get(0);
    batchSize = parsedConfig.getInt(TASK_BATCH_SIZE_CONFIG);
}
Also used : AbstractConfig(org.apache.kafka.common.config.AbstractConfig) ConfigException(org.apache.kafka.common.config.ConfigException)

Aggregations

AbstractConfig (org.apache.kafka.common.config.AbstractConfig)18 ConfigDef (org.apache.kafka.common.config.ConfigDef)9 Test (org.junit.Test)6 JsonConverter (org.apache.kafka.connect.json.JsonConverter)4 Converter (org.apache.kafka.connect.storage.Converter)4 HeaderConverter (org.apache.kafka.connect.storage.HeaderConverter)4 SimpleHeaderConverter (org.apache.kafka.connect.storage.SimpleHeaderConverter)4 HashMap (java.util.HashMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConfigException (org.apache.kafka.common.config.ConfigException)2 PooledPlcDriverManager (org.apache.plc4x.java.utils.connectionpool.PooledPlcDriverManager)2 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 SecureRandom (java.security.SecureRandom)1 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 LocalTime (java.time.LocalTime)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1