You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gu...@apache.org on 2015/12/03 17:58:30 UTC
kafka git commit: MINOR: ConsoleConsumer - Fix number of processed
messages count
Repository: kafka
Updated Branches:
refs/heads/trunk a5382a333 -> b09663eee
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 <lu...@gmail.com>
Reviewers: Guozhang Wang
Closes #617 from luafran/console-consumer-number-of-processed-messages
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/b09663ee
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/b09663ee
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/b09663ee
Branch: refs/heads/trunk
Commit: b09663eeec2153e2556983b8ef21551e69ee6afc
Parents: a5382a3
Author: Luciano Afranllie <lu...@gmail.com>
Authored: Thu Dec 3 08:58:24 2015 -0800
Committer: Guozhang Wang <wa...@gmail.com>
Committed: Thu Dec 3 08:58:24 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/b09663ee/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 2b9eb84..d560b72 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 {