Beispiel #1
0
 def on_closed_stream(self):
     if self.status != status.CLOSED:
         if self.on_disconnect:
             try:
                 self.on_disconnect()
             except Exception:
                 logger.error("ERROR in on_disconnect() callback", exc_info=True)
Beispiel #2
0
 def invoke_callback(self, *args, **kargs):
     if self._pending_cb:
         try:
             self._pending_cb(*args, **kargs)
         except Exception:
             logger.error('Error in callback for %s', self._pending_meth,
                                                      exc_info=True)
         self._pending_cb = None
Beispiel #3
0
 def on_closed_stream(self):
     if self.status != status.CLOSED:
         if self.on_disconnect:
             try:
                 self.on_disconnect()
             except Exception:
                 logger.error('ERROR in on_disconnect() callback',
                              exc_info=True)
def handle(self, ch):
    msg = ch.message
    msg.rx_channel = ch
    if ch.on_return:
        try:
            ch.on_return(msg)
        except Exception:
            logger.error('ERROR in on_return() callback', exc_info=True)
def handle(self, conn):
    conn.status = status.OPENED
    if conn.heartbeat:
        HeartbeatMonitor(conn).start()
    try:
        conn.on_connect()
    except Exception:
        logger.error('ERROR in on_connect() callback', exc_info=True)
Beispiel #6
0
def handle(self, conn):
    conn.status = status.OPENED
    if conn.heartbeat:
        HeartbeatMonitor(conn).start()
    try:
        conn.on_connect()
    except Exception:
        logger.error('ERROR in on_connect() callback', exc_info=True)
Beispiel #7
0
    def on_closed_stream(self):
        if self.status == status.CLOSED:
            return

        self.status = status.CLOSED
        if self.on_disconnect:
            try:
                self.on_disconnect()
            except Exception:
                logger.error('ERROR in on_disconnect() callback',
                             exc_info=True)
Beispiel #8
0
 def handle_method(self, method):
     pending_meth = self._pending_meth
     if hasattr(method, 'handle'):
         try:
             method.handle(self)
         except AmqpError:
             logger.error('Error while handling %s', method, exc_info=True)
             self.reset()
             return
     if pending_meth and method._name.startswith(pending_meth._name):
         self.invoke_callback()
         self._flush()
def handle(self, conn):
    try:
        mod = id2class[self.class_id]
        method = getattr(mod, 'id2method')[self.method_id]
    except:
        method = None
    conn.reset()
    error_code = id2constant.get(self.reply_code, '')
    logger.warn('Connection Hard Error. code=%r. %s', error_code,
                self.reply_text)
    if conn.on_error:
        try:
            conn.on_error(ConnectionError(error_code, self.reply_text, method))
        except Exception:
            logger.error('ERROR in on_error() callback', exc_info=True)
Beispiel #10
0
def handle(self, conn):
    try:
        mod = id2class[self.class_id]
        method = getattr(mod, 'id2method')[self.method_id]
    except:
        method = None
    conn.reset()
    error_code = id2constant.get(self.reply_code, '')
    logger.warn('Connection Hard Error. code=%r. %s', error_code,
                                                      self.reply_text)
    if conn.on_error:
        try:
            conn.on_error(ConnectionError(error_code, self.reply_text, method))
        except Exception:
            logger.error('ERROR in on_error() callback', exc_info=True)
Beispiel #11
0
def handle(self, channel):
    try:
        mod = id2class[self.class_id]
        method = getattr(mod, 'id2method')[self.method_id]
    except:
        method = None
        raise
    channel.reset()
    error_code = id2constant.get(self.reply_code, '')
    logger.warn('Soft Error. channel=%r code=%r. %s', channel.channel_id,
                error_code, self.reply_text)
    if channel.on_error:
        try:
            channel.on_error(ChannelError(error_code, self.reply_text, method))
        except Exception:
            logger.error('ERROR in on_error() callback for channel %d',
                         channel.channel_id,
                         exc_info=True)
Beispiel #12
0
def handle(self, channel):
    try:
        mod = id2class[self.class_id]
        method = getattr(mod, 'id2method')[self.method_id]
    except:
        method = None
        raise
    channel.reset()
    error_code = id2constant.get(self.reply_code, '')
    logger.warn('Soft Error. channel=%r code=%r. %s', channel.channel_id,
                                                      error_code,
                                                      self.reply_text)
    if channel.on_error:
        try:
            channel.on_error(ChannelError(error_code, self.reply_text, method))
        except Exception:
            logger.error('ERROR in on_error() callback for channel %d',
                                             channel.channel_id, exc_info=True)