3
votes

I am executing Kafka's ConsumerGroupExample consumer which hangs waiting for a message

It appears it is hanging waiting for a message (waiting in example at https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example, at "for (final KafkaStream stream : streams)"

Configuration details: (a) running in VMPlayer, Ubuntu operating system; (b) running Kafka version : 0.8.0; (c) running zookeeper, kafka, consumer and producer on same VM (ubuntu/localhost); (d) using zookeeper that is bundled with this version of Kafka; (e) running Producer example (unchanged, available at cwiki.apache.org/confluence/display/KAFKA/); (f) running Consumer Group example (unchanged, ConsumerGroupExample); (g) successfully setup a topic (kafka-create-topic)

A few of the steps I have taken: (a) repeatedly stopped / started zookeeper, kafka brokers; (b) had producer issuing messages before consumer started; (c) had consumer running before producer (and then having producer send messages); (d) verified that kafka's console consumer (kafka-console-consumer) works and can consume messages issued by the producer; (e) no errors/exceptions in the logs

In all cases I have tried, the consumer (ConsumerGroupExample) hangs waiting for a message despite evidence that there are many messages in the queue.

Is there a configuration problem that I am missing?

Any help is much appreciated!

1
I have no idea how to use Kafka, but didn't Kafka's main character in "The Trial" spend his whole life hanging and waiting for a message? So there's some sort of Kafkaesque irony going on if you're having the same problem :) :)ajb
I guess the program woke up one morning and saw it had turned into a bug.yshavit
I also faced same issue. even after clearing zookeeper and kafka tmp dir still am facing same problem consumer hangs.Shri

1 Answers

0
votes

Not sure what the root cause is for the issue but it was fixed when I cleared out the zookeeper and kafka data (in /tmp by default) and restarted both zookeeper and kafka brokers