Typical Application Scenario
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.
No. |
Step |
Sample Code |
---|---|---|
1 |
Create a Spout to generate random text. |
For details, see Creating a Spout. |
2 |
Create a Bolt to split the random text into words. |
For details, see Creating a Bolt. |
3 |
Create a Blot to calculate the number of times that each word appears. |
For details, see Creating a Bolt. |
4 |
Create a topology. |
For details, see Creating a Topology. |
For details about certain code, see Creating a Spout, Creating a Bolt, and Creating a Topology. For details about complete code, see the Storm-examples project.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.