some things done
This commit is contained in:
13
rabbit/publisher.py
Normal file
13
rabbit/publisher.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
import pika
|
||||
try:
|
||||
n = 10
|
||||
credentials = pika.PlainCredentials("rabbit", "rabbit")
|
||||
connection = pika.BlockingConnection(pika.ConnectionParameters(host="localhost", credentials=credentials, heartbeat=0, socket_timeout=5))
|
||||
channel = connection.channel()
|
||||
channel.exchange_declare(exchange="test",exchange_type='direct')
|
||||
string = "\"" + "a" * n + "\""
|
||||
while True:
|
||||
channel.basic_publish(exchange="test",routing_key="test",body=string.encode('UTF-8'))
|
||||
except Exception:
|
||||
connection.close()
|
||||
Reference in New Issue
Block a user