aboutsummaryrefslogtreecommitdiffstats
path: root/rmq/consumer.py
diff options
context:
space:
mode:
authorGravatar Christopher Baklid <[email protected]>2018-05-25 14:21:10 +0200
committerGravatar Christopher Baklid <[email protected]>2018-05-25 14:21:10 +0200
commit85dbc20a80a2b4c233708be1460da7909e205388 (patch)
tree36d98fca1d490ffe4af0b07defe979389fbe5390 /rmq/consumer.py
parentgenerate new queue based on session id to lock user to their own event chain (diff)
lint
Diffstat (limited to 'rmq/consumer.py')
-rw-r--r--rmq/consumer.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/rmq/consumer.py b/rmq/consumer.py
index 8e1ce2b..2c41e26 100644
--- a/rmq/consumer.py
+++ b/rmq/consumer.py
@@ -3,7 +3,14 @@ import traceback
import pika
from pika.exceptions import ConnectionClosed
-def consume(username='guest', password='guest', host='localhost', port=5672, queue='', callback=None):
+
+def consume(username='guest',
+ password='guest',
+ host='localhost',
+ port=5672,
+ queue='',
+ callback=None):
+
while True:
credentials = pika.PlainCredentials(username, password)
con_params = pika.ConnectionParameters(host, port, '/', credentials)
@@ -21,7 +28,7 @@ def consume(username='guest', password='guest', host='localhost', port=5672, que
channel.start_consuming()
- except:
+ except Exception:
exc = traceback.format_exc()
print(exc, flush=True)