# !/usr/bin/env python
import pika
credentials = pika.PlainCredentials('admin','yaochizaocan')
connection = pika.BlockingConnection(pika.ConnectionParameters(
'59.110.123.17',8008,'/',credentials))
channel = connection.channel()
# 声明queue
channel.queue_declare(queue='balance')
# n RabbitMQ a message can never be sent directly to the queue, it always needs to go through an exchange.
cnt = 4000000
while (cnt !=0):
channel.basic_publish(exchange='',
routing_key='balance',
body='H')
cnt -=1
print(4000000-cnt," [x] 1")
connection.close()
Python生产者发送消息脚本rabbitmq
猜你喜欢
转载自www.cnblogs.com/-pengfei/p/8931337.html
今日推荐
周排行