Page 78 - Python Cơ Bản
P. 78
Э FЪG XVЪG XE чɪ XϰS QШX QIWWEKI PɱR UYIYI Э FЪG
Rɧ] XE WЌ OLEM FɨS QШX [SVOIV \м Pʁ GɨG QIWWEKI RLϼR
чвG Xк GLERRIP hello
import pika
connection = pika.BlockingConnection(pika.Connectio
nParameters(host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
print ' [*] Waiting for messages. To exit press CTR
L+C'
def callback(ch, method, properties, body):
print " [x] Received %r" % (body,)
channel.basic_consume(callback, queue='hello', no_a
ck=True)
channel.start_consuming()
ɇSϰR GSHI Rɧ] GˢRK Gɹ TL϶R OLEM FɨS connection