How does Storm complete the count of words?

  As shown, the word count topology consists of one spout and three bolts downstream.

  1.spout: Dynamically accept data source messages and connect to dynamic data sources.
  2. Sentence segmentation bolt: Split each sentence into words.
  3. Word count bolt: Take the output of the sentence segmentation bolt as input, and count the number of each word.
  The word count bolt (WordCountBolt) subscribes to the output of the SplitSentenceBolt class, saving the number of occurrences of each particular word. Whenever the bolt receives a tuple, it increments the count of the corresponding word by 1 and sends the current count of the word backwards. -----> {"word" : "dog" , "count" : 5}
  4. Report the bolt to subscribe to the output of the WordCountBolt class. Like WordCountBolt, maintain a table of technologies corresponding to all words. When a tuple is received, the reported bolt will update the count data in the table and print the value on the terminal.

  Doesn't the bolt in Storm not store any data? This means that tuple messages are not stored, but data structure storage such as list map can be defined.

  Methods in Spout: open, nextTuple, DeclareOutputField;
  Methods in Bolt: prepare, execute, DeclareOutputField; the
  execute() method is defined by the IBolt interface. This method is called whenever a tuple is received from the subscribed data stream.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324465365&siteId=291194637