public interface CreateTopicPolicy extends Configurable, java.lang.AutoCloseable
An interface for enforcing a policy on create topics requests.
Common use cases are requiring that the replication factor, min.insync.replicas
and/or retention settings for a
topic are within an allowable range.
If create.topic.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).
Modifier and Type | Interface and Description |
---|---|
static class |
CreateTopicPolicy.RequestMetadata
Class containing the create request parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
validate(CreateTopicPolicy.RequestMetadata requestMetadata)
Validate the request parameters and throw a
PolicyViolationException with a suitable error
message if the create topics request parameters for the provided topic do not satisfy this policy. |
configure
void validate(CreateTopicPolicy.RequestMetadata requestMetadata) throws PolicyViolationException
PolicyViolationException
with a suitable error
message if the create topics request parameters for the provided topic 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 topic, other topics in the request will still be processed.requestMetadata
- the create topics request parameters for the provided topic.PolicyViolationException
- if the request parameters do not satisfy this policy.