Beispiel #1
0
    def callback(ch, method, properties, body):
        """
        :param method: ['consumer_tag=ctag1.fe37cc6edbbf4c4595445bddb8b8a1e0', 'delivery_tag=1', 'exchange=forward',
        'redelivered=False', 'routing_key=forward.jack.info']
        :param properties: pika.spec.BasicProperties
        print properties.content_type
        print properties.content_encoding
        print properties.headers
        print properties.delivery_mode
        print properties.priority
        print properties.correlation_id
        print properties.reply_to
        print properties.expiration
        print properties.message_id
        print properties.timestamp
        print properties.type
        print properties.user_id
        print properties.app_id
        print properties.cluster_id
        """
        MQ_LOG.debug("call back routing_key:%s,body:%s", method.routing_key,
                     body)

        p = getProcessor(method.routing_key, body)
        if p:
            p.callback()

        ch.basic_ack(delivery_tag=method.delivery_tag)
Beispiel #2
0
    def callback(ch, method, properties, body):
        """
        :param method: ['consumer_tag=ctag1.fe37cc6edbbf4c4595445bddb8b8a1e0', 'delivery_tag=1', 'exchange=forward',
        'redelivered=False', 'routing_key=forward.jack.info']
        :param properties: pika.spec.BasicProperties
        print properties.content_type
        print properties.content_encoding
        print properties.headers
        print properties.delivery_mode
        print properties.priority
        print properties.correlation_id
        print properties.reply_to
        print properties.expiration
        print properties.message_id
        print properties.timestamp
        print properties.type
        print properties.user_id
        print properties.app_id
        print properties.cluster_id
        """
        MQ_LOG.debug("call back routing_key:%s,body:%s",method.routing_key, body)

        p = getProcessor(method.routing_key, body)
        if p:
            p.callback()

        ch.basic_ack(delivery_tag=method.delivery_tag)
Beispiel #3
0
 def subscribe(self, binding_key):
     if binding_key not in self.binding_keys:
         MQ_LOG.debug("subscribe routing_key:%s", binding_key)
         self.binding_keys.add(binding_key)
         self._bind(binding_key)
Beispiel #4
0
 def publish(self, routing_key, message):
     MQ_LOG.debug("publish routing_key:%s,message:%s", routing_key, message)
     self._publish(routing_key, message)
Beispiel #5
0
 def subscribe(self, binding_key):
     if binding_key not in self.binding_keys:
         MQ_LOG.debug("subscribe routing_key:%s",binding_key)
         self.binding_keys.add(binding_key)
         self._bind(binding_key)
Beispiel #6
0
 def publish(self, routing_key, message):
     MQ_LOG.debug("publish routing_key:%s,message:%s",routing_key, message)
     self._publish(routing_key, message)