在Storm Spout中,命名消费者组

时间:2015-04-14 22:19:26

标签: apache-storm apache-kafka

我目前正在使用: https://github.com/wurstmeister/storm-kafka-0.8-plus/commits/master 已移至: https://github.com/apache/storm/tree/master/external/storm-kafka

我想指定Kafka Consumer Group Name。通过查看storm-kafka代码,我按照设置id来查找在处理使用者配置时从未使用过的内容,但是用于创建存储偏移量信息的zookeeper路径。此链接中的示例是我想要执行此操作的示例:https://labs.spotify.com/2015/01/05/how-spotify-scales-apache-storm/

我是否正确地说使用https://github.com/apache/storm/tree/master/external/storm-kafka代码无法设置消费者群组名称?

1 个答案:

答案 0 :(得分:3)

So far, storm-kafka integration is implemented using SimpleConsumer API of kafka and the format it stores consumer offset in zookeeper is implemented in their own way(JSON format).

If you write spout config like below,

SpoutConfig spoutConfig = new SpoutConfig(zkBrokerHosts,
                "topic name",
                "/kafka/consumers(just an example, path to store consumer offset)",
                "yourTopic");

It will write consumer offset in subdirectories of /kafka/consumers/yourTopic.

Note that by default storm-kafka uses same zookeeper that your Storm uses.