Search in sources :

Example 1 with CONNECTOR_CLIENT_POLICY_CLASS_CONFIG

use of org.apache.kafka.connect.runtime.WorkerConfig.CONNECTOR_CLIENT_POLICY_CLASS_CONFIG in project kafka by apache.

the class ConnectorRestartApiIntegrationTest method startOrReuseConnectWithNumWorkers.

private void startOrReuseConnectWithNumWorkers(int numWorkers) throws Exception {
    connect = connectClusterMap.computeIfAbsent(numWorkers, n -> {
        // setup Connect worker properties
        Map<String, String> workerProps = new HashMap<>();
        workerProps.put(OFFSET_COMMIT_INTERVAL_MS_CONFIG, String.valueOf(OFFSET_COMMIT_INTERVAL_MS));
        workerProps.put(CONNECTOR_CLIENT_POLICY_CLASS_CONFIG, "All");
        // setup Kafka broker properties
        Properties brokerProps = new Properties();
        brokerProps.put("auto.create.topics.enable", String.valueOf(false));
        EmbeddedConnectCluster.Builder connectBuilder = new EmbeddedConnectCluster.Builder().name("connect-cluster").numWorkers(numWorkers).workerProps(workerProps).brokerProps(brokerProps).maskExitProcedures(true);
        EmbeddedConnectCluster connect = connectBuilder.build();
        // start the clusters
        connect.start();
        return connect;
    });
    connect.assertions().assertExactlyNumWorkersAreUp(numWorkers, "Initial group of workers did not start in time.");
}
Also used : PARTITIONS_CONFIG(org.apache.kafka.connect.runtime.TopicCreationConfig.PARTITIONS_CONFIG) TestRule(org.junit.rules.TestRule) LoggerFactory(org.slf4j.LoggerFactory) IntegrationTest(org.apache.kafka.test.IntegrationTest) HashMap(java.util.HashMap) TOPIC_CONFIG(org.apache.kafka.connect.integration.MonitorableSourceConnector.TOPIC_CONFIG) HashSet(java.util.HashSet) TestName(org.junit.rules.TestName) After(org.junit.After) Map(java.util.Map) OFFSET_COMMIT_INTERVAL_MS_CONFIG(org.apache.kafka.connect.runtime.WorkerConfig.OFFSET_COMMIT_INTERVAL_MS_CONFIG) StringConverter(org.apache.kafka.connect.storage.StringConverter) EmbeddedConnectCluster(org.apache.kafka.connect.util.clusters.EmbeddedConnectCluster) CONNECTOR_CLASS_CONFIG(org.apache.kafka.connect.runtime.ConnectorConfig.CONNECTOR_CLASS_CONFIG) VALUE_CONVERTER_CLASS_CONFIG(org.apache.kafka.connect.runtime.ConnectorConfig.VALUE_CONVERTER_CLASS_CONFIG) Before(org.junit.Before) AfterClass(org.junit.AfterClass) Logger(org.slf4j.Logger) Properties(java.util.Properties) AbstractStatus(org.apache.kafka.connect.runtime.AbstractStatus) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Category(org.junit.experimental.categories.Category) Collectors(java.util.stream.Collectors) DEFAULT_TOPIC_CREATION_PREFIX(org.apache.kafka.connect.runtime.TopicCreationConfig.DEFAULT_TOPIC_CREATION_PREFIX) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) KEY_CONVERTER_CLASS_CONFIG(org.apache.kafka.connect.runtime.ConnectorConfig.KEY_CONVERTER_CLASS_CONFIG) TimeUnit(java.util.concurrent.TimeUnit) ConnectorStateInfo(org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo) TASKS_MAX_CONFIG(org.apache.kafka.connect.runtime.ConnectorConfig.TASKS_MAX_CONFIG) Rule(org.junit.Rule) Response(javax.ws.rs.core.Response) REPLICATION_FACTOR_CONFIG(org.apache.kafka.connect.runtime.TopicCreationConfig.REPLICATION_FACTOR_CONFIG) CONNECTOR_SETUP_DURATION_MS(org.apache.kafka.connect.util.clusters.EmbeddedConnectClusterAssertions.CONNECTOR_SETUP_DURATION_MS) CONNECTOR_CLIENT_POLICY_CLASS_CONFIG(org.apache.kafka.connect.runtime.WorkerConfig.CONNECTOR_CLIENT_POLICY_CLASS_CONFIG) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) EmbeddedConnectCluster(org.apache.kafka.connect.util.clusters.EmbeddedConnectCluster) Properties(java.util.Properties) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 Response (javax.ws.rs.core.Response)1 TOPIC_CONFIG (org.apache.kafka.connect.integration.MonitorableSourceConnector.TOPIC_CONFIG)1 AbstractStatus (org.apache.kafka.connect.runtime.AbstractStatus)1 CONNECTOR_CLASS_CONFIG (org.apache.kafka.connect.runtime.ConnectorConfig.CONNECTOR_CLASS_CONFIG)1 KEY_CONVERTER_CLASS_CONFIG (org.apache.kafka.connect.runtime.ConnectorConfig.KEY_CONVERTER_CLASS_CONFIG)1 TASKS_MAX_CONFIG (org.apache.kafka.connect.runtime.ConnectorConfig.TASKS_MAX_CONFIG)1 VALUE_CONVERTER_CLASS_CONFIG (org.apache.kafka.connect.runtime.ConnectorConfig.VALUE_CONVERTER_CLASS_CONFIG)1 DEFAULT_TOPIC_CREATION_PREFIX (org.apache.kafka.connect.runtime.TopicCreationConfig.DEFAULT_TOPIC_CREATION_PREFIX)1 PARTITIONS_CONFIG (org.apache.kafka.connect.runtime.TopicCreationConfig.PARTITIONS_CONFIG)1 REPLICATION_FACTOR_CONFIG (org.apache.kafka.connect.runtime.TopicCreationConfig.REPLICATION_FACTOR_CONFIG)1 CONNECTOR_CLIENT_POLICY_CLASS_CONFIG (org.apache.kafka.connect.runtime.WorkerConfig.CONNECTOR_CLIENT_POLICY_CLASS_CONFIG)1