Untitled
raw download clone
TEXT
views 27
,
size 783 b
#! /usr/bin/python

import pika
import threading
def run(name):
    print("starting")
    i = 0
    while i<9999:
        creds = pika.PlainCredentials('recruit','test1')
        params = pika.ConnectionParameters('localhost',5672,'/',creds)
        connection = pika.BlockingConnection(params)
        channel = connection.channel()
        channel.exchange_declare(exchange='bar',exchange_type='topic')
        channel.queue_declare(queue='hello')
        channel.basic_publish(exchange='bar',routing_key='c35c61fd-0979-475a-bbad-d5b514e4be61',body='asdfasdasdfasdfasdfasdfasdfasdfasdfasdfasdf')
        i = i+1

if __name__ == "__main__":
    t = 0
    while t < 120:
        x = threading.Thread(target=run, args=(1,))
        x.start()
        t=t+1;
close fullscreen
Login or Register to edit or fork this paste. It's free.