Search code examples
javaapache-kafkaapache-storm

How to bind Kafka consumer to Storm spout?


How to send Consumer record to Storm Spout object in one line code ? I have two instance one of them is KafkaConsumer object and other one is StormSpout object. I want to get nextTuple which came from Kafka Consumer poll to Spout using KafkaBolt object.


Solution

  • I think maybe your understanding is a little wrong. You're not supposed to create a KafkaConsumer manually.

    Use the KafkaSpout (or Trident spout) from the org.apache.storm:storm-kafka-client module. You can find guides on how to use it in the Storm documentation at 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.