diff --git a/pymicro/protocols/rabbitmq.py b/pymicro/protocols/rabbitmq.py index 73aad8f..02a465f 100644 --- a/pymicro/protocols/rabbitmq.py +++ b/pymicro/protocols/rabbitmq.py @@ -1,5 +1,6 @@ import pika import uuid +import traceback from pymicro.message import Message class RabbitMQ: @@ -57,7 +58,14 @@ def process_response(self, payload, channel, method, properties, body): ) def run(self): - self.mq_channel.start_consuming() + while 1: + try: + self.mq_channel.start_consuming() + except Exception as err: + if isinstance(err, KeyboardInterrupt): + raise + traceback.print_exc() + def close(self): self.mq_connection.close()