f9af88c
From 6115b1a9be4de41f2c7cbb855405bfd60eff81fc Mon Sep 17 00:00:00 2001
f9af88c
From: Brian Bouterse <bmbouter@gmail.com>
f9af88c
Date: Tue, 9 Feb 2016 14:37:09 -0500
f9af88c
Subject: [PATCH] Adds asynchronous error handling to Qpid transport
f9af88c
f9af88c
Fixes #568
f9af88c
---
f9af88c
 kombu/transport/qpid.py | 9 +++++++++
f9af88c
 1 file changed, 9 insertions(+)
f9af88c
f9af88c
diff --git a/kombu/transport/qpid.py b/kombu/transport/qpid.py
f9af88c
index b458d32..081c6c6 100644
f9af88c
--- a/kombu/transport/qpid.py
f9af88c
+++ b/kombu/transport/qpid.py
f9af88c
@@ -1437,6 +1437,9 @@ def verify_runtime_environment(self):
f9af88c
     def _qpid_session_ready(self):
f9af88c
         os.write(self._w, '0')
f9af88c
 
f9af88c
+    def _qpid_exception(self, obj_with_exception):
f9af88c
+        os.write(self._w, 'e')
f9af88c
+
f9af88c
     def on_readable(self, connection, loop):
f9af88c
         """Handle any messages associated with this Transport.
f9af88c
 
f9af88c
@@ -1594,6 +1597,12 @@ def establish_connection(self):
f9af88c
         conn.client = self.client
f9af88c
         self.session = conn.get_qpid_connection().session()
f9af88c
         self.session.set_message_received_handler(self._qpid_session_ready)
f9af88c
+        conn.get_qpid_connection().set_exception_notify_handler(
f9af88c
+            self._qpid_exception
f9af88c
+        )
f9af88c
+        self.session.set_exception_notify_handler(
f9af88c
+            self._qpid_exception
f9af88c
+        )
f9af88c
         return conn
f9af88c
 
f9af88c
     def close_connection(self, connection):