12 lines
410 B
Python
12 lines
410 B
Python
|
import pika
|
||
|
import sys
|
||
|
|
||
|
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
|
||
|
channel = connection.channel()
|
||
|
|
||
|
channel.exchange_declare(exchange='Logs3', exchange_type='fanout')
|
||
|
|
||
|
message = ' '.join(sys.argv[1:]) or "Info: Hello"
|
||
|
channel.basic_publish(exchange='Logs3', routing_key='', body=message)
|
||
|
print(f" [x] Отправлено сообщение: {message}")
|
||
|
connection.close()
|