Edoardo Comar created KAFKA-4531: ------------------------------------ Summary: 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
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)