Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
/**
 * <p>An interface for enforcing a policy on overriding of client configs via the connector configs.
 *
 * <p>Common use cases are ability to provide principal per connector, <code>sasl.jaas.config</code>
 * and/or enforcing that the producer/consumer configurations for optimizations are within acceptable ranges.
 */
public interface ConnectorClientConfigPolicy extends Configurable, AutoCloseable {

    /**
     * Specifies if the worker should attempt to override the client configs from the connector.
     * Implementation aren't required to override this method as its included to preserve backwards compatibility in ththe edefaultdefault
     * implementation.
     *
     * @return a boolean indicating whether the worker should attempt to override the client configs from the connector
     */
    default boolean useOverrides() {
        return true;
    }

    /**
     * This method will be invoked when {@link ConnectorClientConfigPolicy#useOverrides()} returns true.
     * Worker will invoke this while constructing the producer for the SourceConnectors,  DLQ for SinkConnectors and the consumer for the
     * SinkConnectors to validate if all of the overridden client configurations are allowed per the
     * policy implementation. This would also be invoked during the validate of connector configs via the Rest API.
     *
     * If there are any policy violations, the connector will not be started.
     *
     * @param connectorClientConfigRequest an instance of {@code ConnectorClientConfigRequest} that provides the configs to overridden and
     *                                     its context; never {@code null}
     * @throws PolicyViolationException if any of the overridden property doesn't meet the defined policy
     */
    void validate(ConnectorClientConfigRequest connectorClientConfigRequest) throws PolicyViolationException;
}

...