码迷,mamicode.com
首页 > 编程语言 > 详细

Python 推送RabbitMQ

时间:2019-06-20 09:33:48      阅读:137      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!