Try producing some new data after the consumer is running. Be default, the
consumer only picks up newly produced data.

Thanks,

Jun


On Mon, Nov 18, 2013 at 11:22 AM, Menka <men...@gmail.com> wrote:

> I am a newbie for Kafka and trying to execute the samples for 0.8 beta
> release from
>
>
> https://github.com/apache/kafka/tree/0.8.0-beta1candidate1/examples/src/main/java/kafka/examples
> <
> https://github.com/apache/kafka/tree/0.8.0-beta1-candidate1/examples/src/main/java/kafka/examples
> >
>
> I tried KafkaConsumerProducerDemo and wanted to print what Consumer is
> consuming but its not doing anything (Consumer.java).
>
>
>     public void run() {
>         System.out.println(name + "(consumer)--> in run");
>         Map<String, Integer> topicCountMap = new HashMap<String,
> Integer>();
>         topicCountMap.put(topic, new Integer(1));
>         Map<String, List<KafkaStream<Message>>> consumerMap =
> consumer.createMessageStreams(topicCountMap);
>         KafkaStream<Message> stream =  consumerMap.get(topic).get(0);
>         ConsumerIterator<Message> it = stream.iterator();
>         while(it.hasNext()) {
>            //
> System.out.println(ExampleUtils.getMessage(it.next().message()));
>             System.out.println(name + "(consumer)--> " + new
> String(it.next().message()));
>         }
>
> Any suggestion on what I might be doing wrong here?
>
> Thanks,
> Menka
>
> --
> Blog: http://menkag.blogspot.com
> "Don't let what you cannot do interfere with what you can do" - by John
> Wooden
>

Reply via email to