[ https://issues.apache.org/jira/browse/KAFKA-4531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15749120#comment-15749120 ]
Vahid Hashemian commented on KAFKA-4531: ---------------------------------------- [~ecomar] It would be nice to centralize all config validations in one place as you suggest. Please feel free to re-assign the JIRA if you meant to work on it yourself. Thanks. > 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)