Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
 def init(self):
     CoroutineApplication.init(self)
     AmqpManager.instance().init(self.getConfig().get('amqp_config'))
Exemplo n.º 4
0
 def run(self):
     AmqpManager.instance().getMessageQueue('mq_mess').open(AccessMode.READ)
     CoroutineFlaskApplication.run(self)
Exemplo n.º 5
0
 def _terminate(self):
     AmqpManager.instance().terminate()
     CamelApplication._terminate(self)
Exemplo n.º 6
0
 def init(self):
     CoroutineFlaskApplication.init(self)
     AmqpManager.instance().init(self.getConfig().get('amqp_config'))
     TraceService.instance().init(self.getConfig().get('data_tracer'))
Exemplo n.º 7
0
 def _setupAmqp(self):
     from camel.fundamental.amqp import AmqpManager
     AmqpManager.instance().init(self.getConfig().get('amqp_config'))
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
 def onDataRecieved(self, data):
     mq2 = AmqpManager.instance().getMessageQueue('mq_2')
     mq3 = AmqpManager.instance().getMessageQueue('mq_3')
     mq2.produce(data)
     mq3.produce(data)
Exemplo n.º 10
0
 def init(self):
     CoroutineApplication.init(self)
     AmqpManager.instance().init(self.getConfig().get('amqp_config'))
     Accumulator.instance().init(self.getConfig().get('aggregator'))