[
https://issues.apache.org/jira/browse/KAFKA-4531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15796664#comment-15796664
]
Vahid Hashemian commented on KAFKA-4531:
----------------------------------------
[~ewencp] Just saw your earlier comment after submitting the PR. I'll spend
some time to provide an alternative solution based on your suggestion.
> Rationalise client configuration validation
> --------------------------------------------
>
> Key: KAFKA-4531
> URL: https://issues.apache.org/jira/browse/KAFKA-4531
> Project: Kafka
> Issue Type: Improvement
> Components: clients
> Reporter: Edoardo Comar
> Assignee: Vahid Hashemian
>
> The broker-side configuration has a {{validateValues()}} method that could be
> introduced also in the client-side {{ProducerConfig}} and {{ConsumerConfig}}
> classes.
> The rationale is to centralise constraints between values, like e.g. this one
> currently in the {{KafkaConsumer}} constructor:
> {code}
> if (this.requestTimeoutMs <= sessionTimeOutMs ||
> this.requestTimeoutMs <= fetchMaxWaitMs)
> throw new
> ConfigException(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG + " should be
> greater than " + ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG + " and " +
> ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG);
> {code}
> or custom validation of the provided values, e.g. this one in the
> {{KafkaProducer}} :
> {code}
> private static int parseAcks(String acksString) {
> try {
> return acksString.trim().equalsIgnoreCase("all") ? -1 :
> Integer.parseInt(acksString.trim());
> } catch (NumberFormatException e) {
> throw new ConfigException("Invalid configuration value for
> 'acks': " + acksString);
> }
> }
> {code}
> also some new KIPs, e.g. KIP-81 propose constraints among different values,
> so it would be good not to scatter them around.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)