Introducing the word count topology data flow
Our word count topology (depicted in the following diagram) will consist of a single spout connected to three downstream bolts.
Sentence spout
The SentenceSpout
class will simply emit a stream of single-value tuples with the key name "sentence"
and a string value (a sentence), as shown in the following code:
{ "sentence":"my dog has fleas" }
To keep things simple, the source of our data will be a static list of sentences that we loop over, emitting a tuple for every sentence. In a real-world application, a spout would typically connect to a dynamic source, such as tweets retrieved from ...
Get Storm Blueprints: Patterns for Distributed Real-time Computation now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.