I need some help from you in this problem . I read that spout is
responsible for reading data or preparing it for processing in Bolt . so i
wrote some code in spout to open the file and read line by line
class SimSpout(storm.Spout):
# Not much to do here for such a basic spout
def initialize(self, conf, context):
## Open the file with read only permit
self.f = open('data.txt', 'r')
## Read the first line
self._conf = conf
self._context = context
storm.logInfo("Spout instance starting...")
# Process the next tuple
def nextTuple(self):
# check if it reach at the EOF to close it
for line in self.f.readlines():
# Emit a random sentence
storm.logInfo("Emiting %s" % line)
storm.emit([line])
# Start the spout when it's invoked
SimSpout().run()
Is that right ?
The actual problem with me now , How can i make Bolt take each line from
spout to make the processing on it as the processing on it is to read from
another file some calculations to compute the vector of each word