发布时间:2019-09-01 09:51:05编辑:auto阅读(1675)
#!/usr/bin/env python
#-*- coding: utf8 -*-
import pika
import traceback
try:
connection = pika.BlockingConnection(pika.ConnectionParameters(host='192.168.4.226'))
channel = connection.channel()
except:
print traceback.print_exc()
def rabbitmq_send(abcde):
try:
channel.queue_declare(queue='abcde')
except:
print traceback.print_exc()
try:
mess = "<message><name>abcde</name><item key='abcde'>%s</item></message>" %abcde
channel.basic_publish(exchange='',
routing_key='abcde',
body = mess)
print '[x] Send abcde'
except:
print traceback.print_exc()
try:
connection.close()
except:
print traceback.print_exc()
if __name__ == "__main__":
sc = rabbitmq_send('abcde')
上一篇: python实现ftp上传
下一篇: python set(集合)
47870
46434
37323
34767
29338
26002
24953
19971
19571
18059
5812°
6437°
5953°
5980°
7086°
5930°
5972°
6463°
6428°
7805°