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
   73   74   75   76   77   78   79   80   81   82   83