[英]InvalidGroupIdException for Kafka spout in Storm
I have defined a basic Storm topology with spout consumer from Kafka (producer is created in Kafka separate module).我已经用来自 Kafka 的 spout 消费者定义了一个基本的 Storm 拓扑(生产者是在 Kafka 单独的模块中创建的)。 However, when I run the application I get this error:
但是,当我运行该应用程序时,出现此错误:
java.lang.RuntimeException: org.apache.kafka.common.errors.InvalidGroupIdException: To use the group management or offset commit APIs, you must provide a valid group.id in the consumer configuration.
at org.apache.storm.utils.Utils$1.run(Utils.java:407) ~[storm-client-2.1.0.jar:2.1.0]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_221]
Caused by: org.apache.kafka.common.errors.InvalidGroupIdException: To use the group management or offset commit APIs, you must provide a valid group.id in the consumer configuration.
How can I set up group id?如何设置群组ID? I am running Storm locally with 2.1.0 version.
我在本地运行 Storm 2.1.0 版本。
Here is the code for the topology:这是拓扑的代码:
val cluster = new LocalCluster()
val bootstrapServers = "localhost:9092"
val brokerHosts = new ZkHosts(bootstrapServers)
val topologyBuilder = new TopologyBuilder()
val spoutConfig = KafkaSpoutConfig.builder(bootstrapServers, "tweets").build()
topologyBuilder.setSpout("kafka_spout", new KafkaSpout(spoutConfig), 1)
val config = new Config()
cluster.submitTopology("kafkaTest", config, topologyBuilder.createTopology())
您应该使用setProp(java.lang.String, java.lang.Object)
和ConsumerConfig.GROUP_ID_CONFIG
在KafkaSpoutConfig
上添加消费者组 ID
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.