somehow I have to let the consumer run once BEFORE the messages are
produced. then run consumer after messages are produced, then it works:


export topic=ttnew21
  sudo -u kafka bin/kafka-topics.sh  --zookeeper localhost:7181 --create
--topic $topic  --partitions 1 --replication-factor 1
echo "first try"
  sudo -u kafka bin/kafka-console-consumer.sh --zookeeper localhost:7181
--consumer-timeout-ms 1000 --topic $topic -group fffffxx
  echo 'asdfasdfsadffadsfasf' | sudo -u kafka bin/kafka-console-producer.sh
--broker-list  localhost:9092 --topic  $topic
echo "second try"
  sudo -u kafka bin/kafka-console-consumer.sh --zookeeper localhost:7181
--consumer-timeout-ms 1000 --topic $topic -group fffffxx


the first try doesn't read anything out (of course) ; the second one works.
but if I remove the first try, the remaining consumer can't read anything
either.



looks like a bug?

On Tue, Feb 24, 2015 at 1:51 PM, Yang <teddyyyy...@gmail.com> wrote:

> in the following code, I just create a new topic, send some messages onto
> the new topic with console producer, then read it with console consumer.
> but after the 3rd line, nothing is printed out.
>
>
>
> export topic=ttnew2
>   sudo -u kafka bin/kafka-topics.sh  --zookeeper localhost:7181 --create
> --topic $topic  --partitions 1 --replication-factor 1
>   echo 'asdfasdfsadffadsfasf' | sudo -u kafka
> bin/kafka-console-producer.sh --broker-list  localhost:9092 --topic  $topic
>   sudo -u kafka bin/kafka-console-consumer.sh --zookeeper localhost:7181
> --topic $topic -group fffff
>
>
> shouldn't I expect the consumer on the 3rd line to read out the messages?
> in fact if I give it --from-beginning,  it works fine
>
>
>
> this is kafka_2.9.2-0.8.1.1
>
>
> Thanks
> Yang
>

Reply via email to