You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2016/08/03 09:56:16 UTC

kafka git commit: KAFKA-3945; Change the type of 'acks' config in console producer to String

Repository: kafka
Updated Branches:
  refs/heads/trunk c89707f31 -> 227c54fa9


KAFKA-3945; Change the type of 'acks' config in console producer to String

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). Currently, the console producer expects an integer for this input and that makes `all` to become an invalid input. This PR fixes this issue by changing the input type to String.

Author: Vahid Hashemian <va...@us.ibm.com>

Reviewers: Manikumar reddy O <ma...@gmail.com>, Grant Henke <granthenke@gmail.com, Ismael Juma <is...@juma.me.uk>

Closes #1618 from vahidhashemian/KAFKA-3945


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/227c54fa
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/227c54fa
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/227c54fa

Branch: refs/heads/trunk
Commit: 227c54fa9e240b7a7f060c2bbbb849379be0d072
Parents: c89707f
Author: Vahid Hashemian <va...@us.ibm.com>
Authored: Wed Aug 3 10:56:06 2016 +0100
Committer: Ismael Juma <is...@juma.me.uk>
Committed: Wed Aug 3 10:56:06 2016 +0100

----------------------------------------------------------------------
 core/src/main/scala/kafka/tools/ConsoleProducer.scala | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/227c54fa/core/src/main/scala/kafka/tools/ConsoleProducer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/tools/ConsoleProducer.scala b/core/src/main/scala/kafka/tools/ConsoleProducer.scala
index 4cc7c20..a4cc3f1 100644
--- a/core/src/main/scala/kafka/tools/ConsoleProducer.scala
+++ b/core/src/main/scala/kafka/tools/ConsoleProducer.scala
@@ -87,7 +87,7 @@ object ConsoleProducer {
     props.put("queue.buffering.max.ms", config.sendTimeout.toString)
     props.put("queue.buffering.max.messages", config.queueSize.toString)
     props.put("queue.enqueue.timeout.ms", config.queueEnqueueTimeoutMs.toString)
-    props.put("request.required.acks", config.requestRequiredAcks.toString)
+    props.put("request.required.acks", config.requestRequiredAcks)
     props.put("request.timeout.ms", config.requestTimeoutMs.toString)
     props.put("key.serializer.class", config.keyEncoderClass)
     props.put("serializer.class", config.valueEncoderClass)
@@ -116,7 +116,7 @@ object ConsoleProducer {
     props.put(ProducerConfig.RETRY_BACKOFF_MS_CONFIG, config.retryBackoffMs.toString)
     props.put(ProducerConfig.METADATA_MAX_AGE_CONFIG, config.metadataExpiryMs.toString)
     props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, config.maxBlockMs.toString)
-    props.put(ProducerConfig.ACKS_CONFIG, config.requestRequiredAcks.toString)
+    props.put(ProducerConfig.ACKS_CONFIG, config.requestRequiredAcks)
     props.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, config.requestTimeoutMs.toString)
     props.put(ProducerConfig.RETRIES_CONFIG, config.messageSendMaxRetries.toString)
     props.put(ProducerConfig.LINGER_MS_CONFIG, config.sendTimeout.toString)
@@ -178,8 +178,8 @@ object ConsoleProducer {
     val requestRequiredAcksOpt = parser.accepts("request-required-acks", "The required acks of the producer requests")
       .withRequiredArg
       .describedAs("request required acks")
-      .ofType(classOf[java.lang.Integer])
-      .defaultsTo(0)
+      .ofType(classOf[java.lang.String])
+      .defaultsTo("0")
     val requestTimeoutMsOpt = parser.accepts("request-timeout-ms", "The ack timeout of the producer requests. Value must be non-negative and non-zero")
       .withRequiredArg
       .describedAs("request timeout ms")