1.3 Quick Start中 Step 5: Start a consumer官网剖析(博主推荐)

不多说,直接上干货!

  一切来源于官网

http://kafka.apache.org/documentation/

Step 5: Start a consumer

Step 5: 消费消息

  Kafka also has a command line consumer that will dump out messages to standard output.

Kafka也提供了一个消费消息的命令行工具,将存储的信息输出出来。
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
This is a message
This is another message



  If you have each of the above commands running in a different terminal then you should now be able to type messages into the producer terminal and see them appear in the consumer terminal.

如果你有2台不同的终端上运行上述命令,那么当你在运行生产者时,消费者就能消费到生产者发送的消息。

  All of the command line tools have additional options; running the command with no arguments will display usage information documenting them in more detail.

所有的命令行工具有很多的选项,你可以查看文档来了解更多的功能。
原文地址:https://www.cnblogs.com/zlslch/p/6767244.html