O'Reilly logo

Building Python Real-Time Applications with Storm by Barry Hart, Kartik Bhatnagar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating your first topology

Now, we'll create a Storm topology that breaks sentences into words and then counts the number of occurrences of each word. Implementing this topology in Storm requires the following components:

  • Sentence spout (randomsentence.py): A topology always begins with a spout; that's how data gets into Storm. The sentence spout will emit an infinite stream of sentences.
  • Splitter bolt (splitsentence.py): This receives sentences and splits them into words.
  • Word count bolt (wordcount.py): This receives words and counts the occurrences. For each word processed, output the word along with the number of occurrences.

The following figure shows how data flows through the topology:

Word count topology

Now that we've seen the basic data flow, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required