distributed-computing/tasks/melnikov-ky/lab_4/Tut3/emit_log.py
2023-12-18 16:21:58 +04:00

12 lines
464 B
Python

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