cleanup and kafka producer
This commit is contained in:
@ -12,7 +12,6 @@ def callback(ch, method, properties, body):
|
||||
|
||||
|
||||
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()
|
||||
|
@ -7,7 +7,8 @@ try:
|
||||
channel = connection.channel()
|
||||
channel.exchange_declare(exchange="test",exchange_type='direct')
|
||||
string = "\"" + "a" * n + "\""
|
||||
binstring = string.encode('UTF-8')
|
||||
while True:
|
||||
channel.basic_publish(exchange="test",routing_key="test",body=string.encode('UTF-8'))
|
||||
channel.basic_publish(exchange="test",routing_key="test",body=binstring)
|
||||
except Exception:
|
||||
connection.close()
|
||||
|
Reference in New Issue
Block a user