[ https://issues.apache.org/jira/browse/KAFKA-3945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15373912#comment-15373912 ]
ASF GitHub Bot commented on KAFKA-3945: --------------------------------------- GitHub user vahidhashemian opened a pull request: https://github.com/apache/kafka/pull/1618 KAFKA-3945: Fix validation of 'acks' config in console producer The `acks` config that is provided to console producer with `request-required-acks` comes with `all`, `-1`, `0`, `1` as valid options (`all` and `-1` being interchangeable). This PR input validation so that `all` is also accepted as an input value. You can merge this pull request into a Git repository by running: $ git pull https://github.com/vahidhashemian/kafka KAFKA-3945 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/1618.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 #1618 ---- commit fba6a2b1e272a43196b7d7125e202b9da3f29949 Author: Vahid Hashemian <vahidhashem...@us.ibm.com> Date: 2016-07-12T23:03:04Z KAFKA-3945: Fix validation of 'acks' config in console producer The 'acks' config that is provided to console producer with 'request-required-acks' comes with 'all', -1, 0, 1 as valid options (with 'all' and -1 being interchangeable). This PR input validation so that 'all' is also accepted as an input value. ---- > kafka-console-producer.sh does not accept request-required-acks=all > ------------------------------------------------------------------- > > Key: KAFKA-3945 > URL: https://issues.apache.org/jira/browse/KAFKA-3945 > Project: Kafka > Issue Type: Bug > Reporter: James Cheng > Assignee: Vahid Hashemian > > The Java producer accepts 0, 1, -1, and all as valid values for acks. The > kafka-console-producer.sh however does not accept "all" as a valid value. > {code} > $ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test > --request-required-acks all > Cannot parse argument 'all' of option request-required-acks > {code} > The code seems to expect it to be an integer: > https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/tools/ConsoleProducer.scala#L178-L182 > If I pass in an Integer, though, the error message for it says that "all" is > a valid value. > {code} > $ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test > --request-required-acks 2 > org.apache.kafka.common.config.ConfigException: Invalid value 2 for > configuration acks: String must be one of: all, -1, 0, 1 > at > org.apache.kafka.common.config.ConfigDef$ValidString.ensureValid(ConfigDef.java:827) > at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:427) > at > org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:55) > at > org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:62) > at > org.apache.kafka.clients.producer.ProducerConfig.<init>(ProducerConfig.java:338) > at > org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:188) > at kafka.producer.NewShinyProducer.<init>(BaseProducer.scala:40) > at kafka.tools.ConsoleProducer$.main(ConsoleProducer.scala:45) > at kafka.tools.ConsoleProducer.main(ConsoleProducer.scala) > {code} > Either the kafka-console-producer.sh needs to be updated to accept "all", or > the documentation for kafka-console-producer should be updated to say that > "all" is not a valid value. Either way, the two should be in sync with each > other. -- This message was sent by Atlassian JIRA (v6.3.4#6332)