import pika import time import random connection = pika.BlockingConnection(pika.ConnectionParameters(host='rabbitmq')) channel = connection.channel() channel.exchange_declare(exchange='lunch_logs', exchange_type='fanout') events = [ "Новый заказ на завтрак", "Новый заказ на обед", "Новый заказ на ужин", "Пользователь запросил меню" ] while True: message = random.choice(events) channel.basic_publish(exchange='lunch_logs', routing_key='', body=message) print(f" [x] Sent {message}") time.sleep(1)