test

import pika

def callback(ch, method, properties, body):
print(" [x] Received %r" % body)

connection = pika.BlockingConnection(pika.ConnectionParameters(‘localhost’))
channel = connection.channel()
channel.queue_declare(queue=‘hello’)
channel.basic_publish(exchange=’’, routing_key=‘hello’, body=‘yang’)
connection.close()

channel.basic_consume(“hello”, callback, auto_ack=True)

channel.start_consuming()

发布了104 篇原创文章 · 获赞 73 · 访问量 30万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览