def initialize(self, conf, ctx): # Getting the prperties file as a dictionary config = ReadProperties() self.props = config.getProperties() # size of slot duration self.duration = int(self.props['slot_duration']) # start time of slot self.start_ts = int(self.props['ts_start']) # Initialize redis client self.r = redis.StrictRedis(host='localhost', port=6379, db=0)
def initialize(self, stormconf, context): """Method will be called once when the spout is initialized. Perform all initialization stuff inside this method""" client = MongoClient() self.db = client.twitterstream #Load tweets from MongoDB in batch of batch_size #Get batch size from config file config = ReadProperties() self.props = config.getProperties() self.batch_size = int(self.props['batch_size']) self.batch_no = 0 self.tweets = None