如何将 Kafka 消费者绑定到 Storm spout?

How to bind Kafka consumer to Storm spout?

如何在一行代码中将消费者记录发送到 Storm Spout 对象?我有两个实例,其中一个是 KafkaConsumer 对象,另一个是 StormSpout 对象。我想使用 KafkaBolt 对象将来自 Kafka Consumer 民意调查的 nextTuple 发送到 Spout。

我想你的理解可能有点不对。您不应该手动创建 KafkaConsumer。

使用 org.apache.storm:storm-kafka-client 模块中的 KafkaSpout(或 Trident spout)。您可以在 https://storm.apache.org/releases/2.0.0-SNAPSHOT/storm-kafka-client.html, and example code at https://github.com/apache/storm/tree/master/examples/storm-kafka-client-examples.

的 Storm 文档中找到有关如何使用它的指南