Suri
Suri

Reputation: 229

Create a Storm topology pointing to Kafka Producer / Sample Java Code

Thanks in advance. I just need a one single java class (sample code having Storm topology) that reads kafka producer and process it (bolt). I knew there are few samples available in github but I am pretty new to github, maven etc..which makes it tough for me.

And also how can I make sure that bolt is able to read the spout stream successfully?

Really appreciate your help.

Thanks

Upvotes: 0

Views: 1929

Answers (1)

Matthias J. Sax
Matthias J. Sax

Reputation: 62350

Your question is quite generic and thus hard to answer. Here is an example of an Kafka Spout https://github.com/apache/storm/blob/master/external/storm-kafka/src/jvm/org/apache/storm/kafka/KafkaSpout.java

You also need to implement your own Bolt (using IRichBolt or BaseBolt).

In you main method you can plug them together using TopolgoyBuilder. Like this: https://github.com/apache/storm/blob/master/examples/storm-starter/src/jvm/org/apache/storm/starter/WordCountTopology.java

The WorkCount-Example also contains code that execute the code either locally (LocalCluster) or remotely in a real Storm Cluster (StormSubmitter).

Hope this helps. The examples are independent of maven/git. Just use your preferred IDE to run it.

You should also check out the Storm web site: https://storm.apache.org/documentation/Home.html and read the pages "Rationale", "Tutorial", "Setting up development environment", and "Creating a new Storm project".

Upvotes: 1

Related Questions