aboutsummaryrefslogtreecommitdiff
path: root/wordcount/src/spouts/words.py
blob: 6ba88c1e9234a138eb3fc035f69bc3db7d2fe5ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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])