distributed-computing/tasks/klementeva-ja/lab_4/python4Lab/Tut3/emit_log.py
2023-12-16 11:48:57 +04:00

12 lines
460 B
Python

import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='KlementevaLogs', exchange_type='fanout')
message = ' '.join(sys.argv[1:]) or "My name is Zhanna Klementeva from ISEbd-41!"
channel.basic_publish(exchange='KlementevaLogs', routing_key='', body=message)
print(f" [x] Отправлено сообщение: {message}")
connection.close()