import pika import json import time connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel = connection.channel() channel.queue_declare(queue='product_recommendation_queue') channel.queue_bind(exchange='online_store_events', queue='product_recommendation_queue') def callback(ch, method, properties, body): message = json.loads(body) print(f"Received message in product_recommendation_queue: {message}") print(f"Обработка рекомендации: {message}") channel.basic_consume(queue='product_recommendation_queue', on_message_callback=callback, auto_ack=True) print(' [*] Waiting for messages. To exit press CTRL+C') channel.start_consuming()