这不起作用
#!/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()
答案 0 :(得分:1)
由于您没有提到错误,我建议您检查以下几点。