Python 推送RabbitMQ

2020-12-13 02:49

阅读:394

标签:bind   plain   publish   python   pytho   ram   user   code   lock   

username = xxxxxxxx
pwd = xxxxxxxx
user_pwd = pika.PlainCredentials(username, pwd)
s_conn = pika.BlockingConnection(pika.ConnectionParameters(110.318.111.211, credentials=user_pwd))
chan = s_conn.channel()
queuename = "pre_weibo_test"
exchange = "pre_weibo_test_exchange"
routkey = "pre_weibo_test"
chan.exchange_declare(exchange,"topic")
chan.queue_declare(queue=queuename)
chan.queue_bind(queue=queuename, exchange=exchange, routing_key=routkey)
chan.basic_publish(exchange=exchange,routing_key=routkey,body= json data1)
s_conn.close()

 

Python 推送RabbitMQ

标签:bind   plain   publish   python   pytho   ram   user   code   lock   

原文地址:https://www.cnblogs.com/xuchunlin/p/11056504.html


评论


亲,登录后才可以留言!