def startService(self): from message_processor import PyGoWaveMessageProcessor self.mp = PyGoWaveMessageProcessor() self.lc = LoopingCall(self.mp.purge_connections) self.lc2 = LoopingCall(self.mp.log_stats) self.lc.start(10 * 60) # Purge every 10 minutes self.lc2.start(60 * 60, now=False) # Stats every 60 minutes log.msg("=> PyGoWave Server service ready <=")
class PyGoWaveService(Service): """ Main service for PyGoWave, which processes incoming messages. """ implements(IPyGoWaveService) def factoryReady(self, factory): log.msg("=> PyGoWave Server factory ready <=") def messageQueueInfo(self): return [ { "queue_name": "wavelet_server_singlethread", "exchange": "wavelet.topic", "routing_key": "*.*.clientop", "exchange_type": "topic", }, { "queue_name": "wavelet_server_singlethread", "exchange": "federation.topic", "routing_key": "*.*.fedinop", "exchange_type": "topic", }, ] def startService(self): from message_processor import PyGoWaveMessageProcessor self.mp = PyGoWaveMessageProcessor() self.lc = LoopingCall(self.mp.purge_connections) self.lc2 = LoopingCall(self.mp.log_stats) self.lc.start(10 * 60) # Purge every 10 minutes self.lc2.start(60 * 60, now=False) # Stats every 60 minutes log.msg("=> PyGoWave Server service ready <=") def stopService(self): if self.lc.running: self.lc.stop() if self.lc2.running: self.lc2.stop() self.lc = None self.lc2 = None self.mp = None def process(self, rkey, message_data): return self.mp.process(rkey, message_data)