15 lines
533 B
Python
15 lines
533 B
Python
import time
|
|
|
|
import pika
|
|
user = pika.PlainCredentials("id", "pwd")
|
|
parameters = pika.ConnectionParameters("172.20.80.100", credentials=user)
|
|
connection = pika.BlockingConnection(parameters)
|
|
|
|
if __name__ == '__main__':
|
|
channel = connection.channel()
|
|
# channel.queue_declare(queue="mch", durable=True)
|
|
channel.queue_bind(exchange="test", queue="mch", routing_key="mch")
|
|
while True:
|
|
body = "ip:port"
|
|
channel.basic_publish(exchange='test', routing_key='mch', body=body)
|
|
time.sleep(3) |