Updated on 2024-08-16 GMT+08:00

Storm Development Plan

A typical scenario can help you quickly learn and master the Storm topology structure and Spout/Bolt development process.

Scenario Description

Service processing of a dynamic word counting system is described as follows. The data source is a logical unit that produces random text continuously.

  • The data source continuously sends random text, such as "apple orange apple", to the text splitting logic.
  • The word splitting logic splits each text entry sent by the data source by space, such as "apple", "orange", "apple", and then sends each word to the word counting logic.
  • The word counting logic increases the number of times that a specific word occurs by one when receiving the word, and prints the real-time results. For example:
    • apple: 1
    • orange: 1
    • apple: 2

Function Description

Table 1 describes the procedure for a user to develop an application to calculate the number of times that each word appears in random text.

Table 1 Functions to be developed

No.

Step

Sample Code

1

Create a Spout to generate random text.

For details, see Creating a Storm Spout.

2

Create a Bolt to split the random text into words.

For details, see Creating a Storm Bolt.

3

Create a Blot to calculate the number of times that each word appears.

For details, see Creating a Storm Bolt.

4

Create a topology.

For details, see Creating a Storm Topology.

For details about certain code, see Creating a Storm Spout, Creating a Storm Bolt, and Creating a Storm Topology. For details about complete code, see the Storm-examples project.