Search in sources :

Example 1 with ConnectorType

use of org.apache.kafka.connect.health.ConnectorType in project kafka by apache.

the class Worker method connectorClientConfigOverrides.

private static Map<String, Object> connectorClientConfigOverrides(ConnectorTaskId id, ConnectorConfig connConfig, Class<? extends Connector> connectorClass, String clientConfigPrefix, ConnectorType connectorType, ConnectorClientConfigRequest.ClientType clientType, ConnectorClientConfigOverridePolicy connectorClientConfigOverridePolicy) {
    Map<String, Object> clientOverrides = connConfig.originalsWithPrefix(clientConfigPrefix);
    ConnectorClientConfigRequest connectorClientConfigRequest = new ConnectorClientConfigRequest(id.connector(), connectorType, connectorClass, clientOverrides, clientType);
    List<ConfigValue> configValues = connectorClientConfigOverridePolicy.validate(connectorClientConfigRequest);
    List<ConfigValue> errorConfigs = configValues.stream().filter(configValue -> configValue.errorMessages().size() > 0).collect(Collectors.toList());
    // These should be caught when the herder validates the connector configuration, but just in case
    if (errorConfigs.size() > 0) {
        throw new ConnectException("Client Config Overrides not allowed " + errorConfigs);
    }
    return clientOverrides;
}
Also used : LoggingContext(org.apache.kafka.connect.util.LoggingContext) SinkUtils(org.apache.kafka.connect.util.SinkUtils) JsonConverterConfig(org.apache.kafka.connect.json.JsonConverterConfig) Plugins(org.apache.kafka.connect.runtime.isolation.Plugins) LoggerFactory(org.slf4j.LoggerFactory) ConnectorType(org.apache.kafka.connect.health.ConnectorType) OffsetStorageWriter(org.apache.kafka.connect.storage.OffsetStorageWriter) ErrorHandlingMetrics(org.apache.kafka.connect.runtime.errors.ErrorHandlingMetrics) CloseableOffsetStorageReader(org.apache.kafka.connect.storage.CloseableOffsetStorageReader) ErrorReporter(org.apache.kafka.connect.runtime.errors.ErrorReporter) Converter(org.apache.kafka.connect.storage.Converter) Map(java.util.Map) DeadLetterQueueReporter(org.apache.kafka.connect.runtime.errors.DeadLetterQueueReporter) OffsetBackingStore(org.apache.kafka.connect.storage.OffsetBackingStore) OffsetStorageReader(org.apache.kafka.connect.storage.OffsetStorageReader) ClassLoaderUsage(org.apache.kafka.connect.runtime.isolation.Plugins.ClassLoaderUsage) ConnectUtils(org.apache.kafka.connect.util.ConnectUtils) TopicCreationGroup(org.apache.kafka.connect.util.TopicCreationGroup) Time(org.apache.kafka.common.utils.Time) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ConsumerConfig(org.apache.kafka.clients.consumer.ConsumerConfig) ConfigValue(org.apache.kafka.common.config.ConfigValue) SourceRecord(org.apache.kafka.connect.source.SourceRecord) Collectors(java.util.stream.Collectors) Executors(java.util.concurrent.Executors) List(java.util.List) SinkRecord(org.apache.kafka.connect.sink.SinkRecord) Task(org.apache.kafka.connect.connector.Task) JsonConverter(org.apache.kafka.connect.json.JsonConverter) ConnectorClientConfigOverridePolicy(org.apache.kafka.connect.connector.policy.ConnectorClientConfigOverridePolicy) KafkaConsumer(org.apache.kafka.clients.consumer.KafkaConsumer) SourceTask(org.apache.kafka.connect.source.SourceTask) OffsetStorageReaderImpl(org.apache.kafka.connect.storage.OffsetStorageReaderImpl) Connector(org.apache.kafka.connect.connector.Connector) ConfigProvider(org.apache.kafka.common.config.provider.ConfigProvider) ConnectorTaskId(org.apache.kafka.connect.util.ConnectorTaskId) TopicAdmin(org.apache.kafka.connect.util.TopicAdmin) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) LogReporter(org.apache.kafka.connect.runtime.errors.LogReporter) KafkaProducer(org.apache.kafka.clients.producer.KafkaProducer) HeaderConverter(org.apache.kafka.connect.storage.HeaderConverter) WorkerErrantRecordReporter(org.apache.kafka.connect.runtime.errors.WorkerErrantRecordReporter) MetricGroup(org.apache.kafka.connect.runtime.ConnectMetrics.MetricGroup) ProducerConfig(org.apache.kafka.clients.producer.ProducerConfig) ExecutorService(java.util.concurrent.ExecutorService) SinkTask(org.apache.kafka.connect.sink.SinkTask) Utils(org.apache.kafka.common.utils.Utils) Callback(org.apache.kafka.connect.util.Callback) Logger(org.slf4j.Logger) ConnectorClientConfigRequest(org.apache.kafka.connect.connector.policy.ConnectorClientConfigRequest) AdminClientConfig(org.apache.kafka.clients.admin.AdminClientConfig) ClusterConfigState(org.apache.kafka.connect.runtime.distributed.ClusterConfigState) MetricNameTemplate(org.apache.kafka.common.MetricNameTemplate) TimeUnit(java.util.concurrent.TimeUnit) ConnectException(org.apache.kafka.connect.errors.ConnectException) RetryWithToleranceOperator(org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator) Collections(java.util.Collections) ConnectorClientConfigRequest(org.apache.kafka.connect.connector.policy.ConnectorClientConfigRequest) ConfigValue(org.apache.kafka.common.config.ConfigValue) ConnectException(org.apache.kafka.connect.errors.ConnectException)

Aggregations

ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors (java.util.concurrent.Executors)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 AdminClientConfig (org.apache.kafka.clients.admin.AdminClientConfig)1 ConsumerConfig (org.apache.kafka.clients.consumer.ConsumerConfig)1 KafkaConsumer (org.apache.kafka.clients.consumer.KafkaConsumer)1 KafkaProducer (org.apache.kafka.clients.producer.KafkaProducer)1 ProducerConfig (org.apache.kafka.clients.producer.ProducerConfig)1 MetricNameTemplate (org.apache.kafka.common.MetricNameTemplate)1 ConfigValue (org.apache.kafka.common.config.ConfigValue)1