發(fā)送端:
化德網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),化德網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為化德1000+提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站制作要多少錢,請找那個售后服務(wù)好的化德做網(wǎng)站的公司定做!
import pika connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) channel = connection.channel() channel.queue_declare(queue='hello') # for i in range(100): channel.basic_publish(exchange='', routing_key='hello', body="hello world") # print("Sent 'hello world!'") connection.close()
接收端:
#!/usr/bin/env python import pika import time connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel = connection.channel() channel.queue_declare(queue='hello') # channel.queue_bind(queue='hello',exchange='',routing_key='hello') def callback(ch, method, properties, body): print("aaa") time.sleep(8) print(" [x] Received %r" % body) channel.basic_consume(callback, queue='hello', no_ack=False) print(' [*] Waiting for messages. To exit press CTRL+C') channel.start_consuming()
分享標題:pythonrabbitmqno_ack=false
網(wǎng)站網(wǎng)址:http://www.2m8n56k.cn/article34/giodpe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、品牌網(wǎng)站設(shè)計、微信小程序、網(wǎng)站排名、網(wǎng)站設(shè)計公司、網(wǎng)站維護
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)