August 2017
Beginner to intermediate
278 pages
6h 40m
English
We will be taking the famous wordcount example for Storm Kafka integration, where KafkaSpout will read input from kafka topic and it will be processed by split bolt and count bolt. Let's start with topology class.
Topology Class: The flow connection of spouts and bolts together forms a topology. In the following code, we have the TopologyBuilder class which allows us to set the connection flow:
TopologyBuilder topologyBuilder = new TopologyBuilder(); topologyBuilder.setSpout("kafkaspout", new KafkaSpout(kafkaSpoutConfig)); topologyBuilder.setBolt("stringsplit", new StringToWordsSpliterBolt()).shuffleGrouping("kafkaspout"); topologyBuilder.setBolt("counter", new WordCountCalculatorBolt()).shuffleGrouping("stringsplit");
In the preceding ...
Read now
Unlock full access