Interface AlterConfigPolicy

  • All Superinterfaces:
    java.lang.AutoCloseable, Configurable

    public interface AlterConfigPolicy
    extends Configurable, java.lang.AutoCloseable

    An interface for enforcing a policy on alter configs requests.

    Common use cases are requiring that the replication factor, min.insync.replicas and/or retention settings for a topic remain within an allowable range.

    If alter.config.policy.class.name is defined, Kafka will create an instance of the specified class using the default constructor and will then pass the broker configs to its configure() method. During broker shutdown, the close() method will be invoked so that resources can be released (if necessary).

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  AlterConfigPolicy.RequestMetadata
      Class containing the create request parameters.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void validate​(AlterConfigPolicy.RequestMetadata requestMetadata)
      Validate the request parameters and throw a PolicyViolationException with a suitable error message if the alter configs request parameters for the provided resource do not satisfy this policy.
      • Methods inherited from interface java.lang.AutoCloseable

        close
    • Method Detail

      • validate

        void validate​(AlterConfigPolicy.RequestMetadata requestMetadata)
               throws PolicyViolationException
        Validate the request parameters and throw a PolicyViolationException with a suitable error message if the alter configs request parameters for the provided resource do not satisfy this policy. Clients will receive the POLICY_VIOLATION error code along with the exception's message. Note that validation failure only affects the relevant resource, other resources in the request will still be processed.
        Parameters:
        requestMetadata - the alter configs request parameters for the provided resource (topic is the only resource type whose configs can be updated currently).
        Throws:
        PolicyViolationException - if the request parameters do not satisfy this policy.