Interface ConnectorClientConfigOverridePolicy

All Superinterfaces:
AutoCloseable, Configurable, ConnectPlugin, Versioned

public interface ConnectorClientConfigOverridePolicy extends Configurable, AutoCloseable, ConnectPlugin
An interface for enforcing a policy on overriding of Kafka client configs via the connector configs.

Common use cases are ability to provide principal per connector, sasl.jaas.config and/or enforcing that the producer/consumer configurations for optimizations are within acceptable ranges.

Kafka Connect discovers implementations of this interface using the Java ServiceLoader mechanism. To support this, implementations of this interface should also contain a service provider configuration file in META-INF/services/org.apache.kafka.connect.connector.policy.ConnectorClientConfigOverridePolicy.

Implement Monitorable to enable the policy to register metrics. The following tags are automatically added to all metrics registered: config set to connector.client.config.override.policy, and class set to the ConnectorClientConfigOverridePolicy class name.

  • Method Summary

    Modifier and Type
    Method
    Description
    default ConfigDef
    Configuration specification for this policy override.
    validate(ConnectorClientConfigRequest connectorClientConfigRequest)
    Workers will invoke this before configuring per-connector Kafka admin, producer, and consumer client instances to validate if all the overridden client configurations are allowed per the policy implementation.
    default String
    Get the version of this component.

    Methods inherited from interface java.lang.AutoCloseable

    close

    Methods inherited from interface org.apache.kafka.common.Configurable

    configure
  • Method Details

    • validate

      List<ConfigValue> validate(ConnectorClientConfigRequest connectorClientConfigRequest)
      Workers will invoke this before configuring per-connector Kafka admin, producer, and consumer client instances to validate if all the overridden client configurations are allowed per the policy implementation. This would also be invoked during the validation of connector configs via the REST API.

      If there are any policy violations, the connector will not be started.

      Parameters:
      connectorClientConfigRequest - an instance of ConnectorClientConfigRequest that provides the configs to be overridden and its context; never null
      Returns:
      list of ConfigValue instances that describe each client configuration in the request and includes an error if the configuration is not allowed by the policy; never null
    • config

      default ConfigDef config()
      Configuration specification for this policy override.
      Specified by:
      config in interface ConnectPlugin
      Returns:
      the configuration definition for this policy override; never null
    • version

      default String version()
      Get the version of this component.
      Specified by:
      version in interface Versioned
      Returns:
      the version, formatted as a String. The version may not be null or empty.