Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-3945

kafka-console-producer.sh does not accept request-required-acks=all

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.10.1.0
    • None
    • None

    Description

      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.

      $ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test --request-required-acks all
      Cannot parse argument 'all' of option request-required-acks
      

      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.

      $ 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)
      

      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.

      Attachments

        Issue Links

          Activity

            People

              vahid Vahid Hashemian
              wushujames James Cheng
              Ismael Juma Ismael Juma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: