rrr

# coding:utf-8
import pika

username = 'feng'
password = 'nihao'
host = '192.168.1.144'
 
credentials = pika.PlainCredentials(username, password)
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host, credentials=credentials, port=5672))
channel = connection.channel()
 
channel.queue_declare(queue='trans_queue',auto_delete=True)
 
channel.basic_publish(exchange='',
                      routing_key='hello',
                      body='Hello World!')
 
print "[x] Sent 'Hello World!'"
connection.close()

 

posted @ 2019-05-07 16:27  hello-Jesson  阅读(444)  评论(0编辑  收藏  举报