[
https://issues.apache.org/jira/browse/KAFKA-4531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15796651#comment-15796651
]
ASF GitHub Bot commented on KAFKA-4531:
---------------------------------------
GitHub user vahidhashemian opened a pull request:
https://github.com/apache/kafka/pull/2302
KAFKA-4531: Centralize validation of configs for consumer and producer
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vahidhashemian/kafka KAFKA-4531
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/2302.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2302
----
commit 84dbb5c29f240756e8a250e70211b0a99aa1be36
Author: Vahid Hashemian <[email protected]>
Date: 2016-12-23T04:58:16Z
KAFKA-4531: Centralize validation of configs for consumer and producer
----
> 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)