def process_amqp_msgs(self):
        """Process AMQP queue messages.

        It connects to AMQP server and calls callbacks to process DCNM events,
        i.e. routing key containing '.cisco.dcnm.', once they arrive in the
        queue.
        """

        LOG.info('Starting process_amqp_msgs...')
        while True:
            (mtd_fr, hdr_fr, body) = (None, None, None)
            try:
                if self.consume_channel:
                    (mtd_fr, hdr_fr, body) = self.consume_channel.basic_get(
                        self._dcnm_queue_name)
                if mtd_fr:
                    # Queue has messages.
                    LOG.info('RX message: %s', body)
                    self._cb_dcnm_msg(mtd_fr, body)
                    self.consume_channel.basic_ack(mtd_fr.delivery_tag)
                else:
                    # Queue is empty.
                    try:
                        self._conn.sleep(1)
                    except AttributeError:
                        time.sleep(1)
            except Exception:
                exc_type, exc_value, exc_tb = sys.exc_info()
                tb_str = traceback.format_exception(exc_type,
                                                    exc_value, exc_tb)
                LOG.exception("Failed to read from queue: %(queue)s "
                              "%(exc_type)s, %(exc_value)s, %(exc_tb)s.", {
                                  'queue': self._dcnm_queue_name,
                                  'exc_type': exc_type,
                                  'exc_value': exc_value,
                                  'exc_tb': tb_str})
def process_amqp_msgs ( self ) : LOG . info ( 'Starting process_amqp_msgs...' ) while True : ( mtd_fr , hdr_fr , body ) = ( None , None , None ) try : if self . consume_channel : ( mtd_fr , hdr_fr , body ) = self . consume_channel . basic_get ( self . _dcnm_queue_name ) if mtd_fr : LOG . info ( 'RX message: %s' , body ) self . _cb_dcnm_msg ( mtd_fr , body ) self . consume_channel . basic_ack ( mtd_fr . delivery_tag ) else : try : self . _conn . sleep ( 1 ) except AttributeError : time . sleep ( 1 ) except Exception : exc_type , exc_value , exc_tb = sys . exc_info ( ) tb_str = traceback . format_exception ( exc_type , exc_value , exc_tb ) LOG . exception ( "Failed to read from queue: %(queue)s " "%(exc_type)s, %(exc_value)s, %(exc_tb)s." , { 'queue' : self . _dcnm_queue_name , 'exc_type' : exc_type , 'exc_value' : exc_value , 'exc_tb' : tb_str } )
Process AMQP queue messages.

        It connects to AMQP server and calls callbacks to process DCNM events,
        i.e. routing key containing '.cisco.dcnm.', once they arrive in the
        queue.