aboutsummaryrefslogtreecommitdiff
path: root/wordcount/src/spouts/words.py
diff options
context:
space:
mode:
Diffstat (limited to 'wordcount/src/spouts/words.py')
-rw-r--r--wordcount/src/spouts/words.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/wordcount/src/spouts/words.py b/wordcount/src/spouts/words.py
new file mode 100644
index 0000000..6ba88c1
--- /dev/null
+++ b/wordcount/src/spouts/words.py
@@ -0,0 +1,14 @@
+from itertools import cycle
+
+from streamparse import Spout
+
+
+class WordSpout(Spout):
+ outputs = ["word"]
+
+ def initialize(self, stormconf, context):
+ self.words = cycle(["dog", "cat", "zebra", "elephant"])
+
+ def next_tuple(self):
+ word = next(self.words)
+ self.emit([word])