From 9ed1c48b569cc638d67a83e86041145a8d345992 Mon Sep 17 00:00:00 2001 From: Julius Unverfehrt Date: Mon, 14 Feb 2022 16:37:20 +0100 Subject: [PATCH] blackkked --- mini_queue/consumer.py | 6 ++---- requirements.txt | 2 +- scripts/mock_publish.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mini_queue/consumer.py b/mini_queue/consumer.py index ae5e076..8b73873 100644 --- a/mini_queue/consumer.py +++ b/mini_queue/consumer.py @@ -5,14 +5,13 @@ from retry import retry from mini_queue.utils.config import CONFIG - - def callback(channel, method, properties, body): print("Received %r" % body) response = body channel.basic_publish(exchange="", routing_key=CONFIG.rabbitmq.queues.output, body=response) channel.basic_ack(delivery_tag=method.delivery_tag) + def init_params(): credentials = pika.PlainCredentials(CONFIG.rabbitmq.user, CONFIG.rabbitmq.password) parameters = pika.ConnectionParameters( @@ -24,7 +23,7 @@ def init_params(): return parameters -#@retry(pika.exceptions.AMQPConnectionError, delay=5, jitter=(1, 3)) +# @retry(pika.exceptions.AMQPConnectionError, delay=5, jitter=(1, 3)) def consume(parameters, queue): connection = pika.BlockingConnection(parameters) channel = connection.channel() @@ -32,4 +31,3 @@ def consume(parameters, queue): print(" [*] Waiting for messages. To exit press CTRL+C") channel.start_consuming() - diff --git a/requirements.txt b/requirements.txt index 8cb2919..bbd140c 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pika retry -envyaml \ No newline at end of file +envyaml diff --git a/scripts/mock_publish.py b/scripts/mock_publish.py index b5df849..6543cc3 100644 --- a/scripts/mock_publish.py +++ b/scripts/mock_publish.py @@ -24,4 +24,4 @@ if __name__ == "__main__": for method_frame, _, body in channel.consume(queue=CONFIG.rabbitmq.queues.output): print(json.loads(body)) - break \ No newline at end of file + break