import pika import time def callback(ch, method, properties, body): print(f" [Consumer 1] {body.decode('utf-8')}") time.sleep(3) ch.basic_ack(delivery_tag=method.delivery_tag) connection = pika.BlockingConnection(pika.ConnectionParameters(host='rabbitmq')) channel = connection.channel() channel.exchange_declare(exchange='lunch_logs', exchange_type='fanout') queue_name = "lunch_queue_slow" channel.queue_declare(queue=queue_name) channel.queue_bind(exchange='lunch_logs', queue=queue_name) print(' [*] Consumer 1 waiting for logs. To exit press CTRL+C') channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=False) channel.start_consuming()