[英]Trying to publish messages to rabbit mq server
This isn't working 这不行
#!/usr/bin/python
import pika
credentials = pika.PlainCredentials('user', 'user')
parameters = pika.ConnectionParameters('rabbitmqqa2.server.com',
15672,
'/',
credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.queue_declare(queue='zabbix-mail')
message = 'Python Queue - Message Sent from sender.py {N|T}'
channel.basic_publish(exchange='zabbix',
routing_key='zabbix-mail-route',
body=message)
print(" [x] Sent 'Hello World!'")
connection.close()
As You've not mentioned error, I can advise you to check following points. 由于您没有提到错误,因此我建议您检查以下几点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.