bluck
This commit is contained in:
parent
b6411de6b2
commit
b9258de347
@ -33,14 +33,14 @@ def main():
|
|||||||
parameters = init_params()
|
parameters = init_params()
|
||||||
connection = pika.BlockingConnection(parameters)
|
connection = pika.BlockingConnection(parameters)
|
||||||
channel = connection.channel()
|
channel = connection.channel()
|
||||||
#channel.queue_declare(queue=CONFIG.rabbitmq.queues.output, durable=True)
|
# channel.queue_declare(queue=CONFIG.rabbitmq.queues.output, durable=True)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
channel.basic_consume(queue=CONFIG.rabbitmq.queues.input, auto_ack=False, on_message_callback=callback)
|
channel.basic_consume(queue=CONFIG.rabbitmq.queues.input, auto_ack=False, on_message_callback=callback)
|
||||||
logging.info(" [*] Waiting for messages. To exit press CTRL+C")
|
logging.info(" [*] Waiting for messages. To exit press CTRL+C")
|
||||||
channel.start_consuming()
|
channel.start_consuming()
|
||||||
|
|
||||||
except pika.exceptions.ConnectionClosedByBroker as err:
|
except pika.exceptions.ConnectionClosedByBroker as err:
|
||||||
logging.info("Caught a channel error: {}, stopping...".format(err))
|
logging.info("Caught a channel error: {}, stopping...".format(err))
|
||||||
continue
|
continue
|
||||||
@ -51,10 +51,8 @@ def main():
|
|||||||
logging.info("Connection was closed, retrying...")
|
logging.info("Connection was closed, retrying...")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logging_level = CONFIG.service.logging_level
|
logging_level = CONFIG.service.logging_level
|
||||||
logging.basicConfig(level=logging_level)
|
logging.basicConfig(level=logging_level)
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user