Now we will create a Storm topology that will consume messages from the Kafka topic new_topic and aggregate words into sentences.
The complete message flow is shown as follows:
We have already seen KafkaSampleProducer, which produces words into the Kafka broker. Now we will create a Storm topology that will read those words from Kafka to aggregate them into sentences. For this, we will have one KafkaSpout in the application that will read the messages from Kafka and two bolts, WordBolt that receive words from KafkaSpout and then aggregate them into sentences, which are then passed onto the SentenceBolt, which simply prints them on the output stream. We will be running this topology in a local mode.
Follow the steps to create the Storm topology:
- Create a new Maven project with groupId as com.stormadvance and artifactId as kafka-storm-topology...