def run(self): if sys.argv[-1] == 'client': AmqpManager.instance().getMessageQueue('test').open(AccessMode.WRITE).produce('abc') print 'one message be sent out' CoroutineApplication.run(self) else: AmqpManager.instance().getMessageQueue('test').open(AccessMode.READ) CoroutineApplication.run(self)
def _onDataReady(self, vehicle_id, data): """数据接收完成之后进行下一步消息的投递 """ data = self._time_twiste(data) if not data: return # return data data = self.buffer.enqueue(vehicle_id, data) if data: # fresh data env = data.toEnvelope() # 发送 DataEnvelope name = self.cfgs.get('post_mq') serial = env.marshall() print serial tick = timestamp_to_str(env.payloads.get( DataCategory.LOC.value).time, fmt='%Y%m%d_%H%M%S') print env.getId(), tick self.count += 1 print 'data sent:', self.count mq = AmqpManager.instance().getMessageQueue(name) mq.produce(serial)
def init(self): CoroutineApplication.init(self) AmqpManager.instance().init(self.getConfig().get('amqp_config'))
def run(self): AmqpManager.instance().getMessageQueue('mq_mess').open(AccessMode.READ) CoroutineFlaskApplication.run(self)
def _terminate(self): AmqpManager.instance().terminate() CamelApplication._terminate(self)
def init(self): CoroutineFlaskApplication.init(self) AmqpManager.instance().init(self.getConfig().get('amqp_config')) TraceService.instance().init(self.getConfig().get('data_tracer'))
def _setupAmqp(self): from camel.fundamental.amqp import AmqpManager AmqpManager.instance().init(self.getConfig().get('amqp_config'))
def run(self): AmqpManager.instance().getMessageQueue('mq_2').open(AccessMode.WRITE) AmqpManager.instance().getMessageQueue('mq_3').open(AccessMode.WRITE) AmqpManager.instance().getMessageQueue('mq_1').open(AccessMode.READ) CoroutineApplication.run(self)
def onDataRecieved(self, data): mq2 = AmqpManager.instance().getMessageQueue('mq_2') mq3 = AmqpManager.instance().getMessageQueue('mq_3') mq2.produce(data) mq3.produce(data)
def init(self): CoroutineApplication.init(self) AmqpManager.instance().init(self.getConfig().get('amqp_config')) Accumulator.instance().init(self.getConfig().get('aggregator'))