kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: MINOR: ConsoleConsumer - Fix number of processed messages count
Date Thu, 03 Dec 2015 16:58:38 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.9.0 ee8a7ce9a -> 2b4c5dc29


MINOR: ConsoleConsumer - Fix number of processed messages count

kafka-console-consumer.sh is showing an incorrect number of
messages processed, counting one more message than the actual
number of processed messages.

Author: Luciano Afranllie <luafran@gmail.com>

Reviewers: Guozhang Wang

Closes #617 from luafran/console-consumer-number-of-processed-messages

(cherry picked from commit b09663eeec2153e2556983b8ef21551e69ee6afc)
Signed-off-by: Guozhang Wang <wangguoz@gmail.com>


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

Branch: refs/heads/0.9.0
Commit: 2b4c5dc290ec6d89206f31856204b713e21c7d2b
Parents: ee8a7ce
Author: Luciano Afranllie <luafran@gmail.com>
Authored: Thu Dec 3 08:58:24 2015 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Thu Dec 3 08:58:34 2015 -0800

----------------------------------------------------------------------
 core/src/main/scala/kafka/tools/ConsoleConsumer.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/2b4c5dc2/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
index 0760336..95a89fa 100755
--- a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
+++ b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
@@ -105,7 +105,6 @@ object ConsoleConsumer extends Logging {
 
   def process(maxMessages: Integer, formatter: MessageFormatter, consumer: BaseConsumer,
skipMessageOnError: Boolean) {
     while (messageCount < maxMessages || maxMessages == -1) {
-      messageCount += 1
       val msg: BaseConsumerRecord = try {
         consumer.receive()
       } catch {
@@ -122,6 +121,7 @@ object ConsoleConsumer extends Logging {
           // Consumer will be closed
           return
       }
+      messageCount += 1
       try {
         formatter.writeTo(msg.key, msg.value, System.out)
       } catch {


Mime
View raw message