#!/usr/bin/env python
#Zhangpengfei

import pika

credentials = pika.PlainCredentials('admin','yaochizaocan')
connection = pika.BlockingConnection(pika.ConnectionParameters(
'59.110.123.17',8008,'/',credentials))
channel = connection.channel()
channel.queue_declare(queue='balance')

def callback(ch, method, properties, body):
print(" [x] Received %r" % body)
channel.basic_qos(prefetch_count=1)
channel.basic_consume(callback,
queue='balance',
no_ack=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()
posted on 2018-04-24 16:15  DisCover_ry  阅读(465)  评论(0编辑  收藏  举报