rabbitmq服务器不接收来自python客户端的消息

时间:2015-06-23 13:27:16

标签: python rabbitmq

我正在尝试向rabbitmq发布消息。这在生产环境环境中使用相同的代码,因此我怀疑这是一个配置问题。

rbqueue = RabbitMQClientQueue('cn-dip-v3', host = rabbitmq_config['host'], username = rabbitmq_config['user'], password = rabbitmq_config['password'])

channel = rbqueue.connection.channel()
args = {"x-max-priority": 10}
channel.queue_declare(queue='cn-dip-v3', durable=True, arguments=args)

result = channel.queue_declare(exclusive=True)
callback_queue = result.method.queue

msgBody = json.dumps({"ohad":123})
# may happen that sendResponseToDal is True but there is no sendResponseToDal method on server side
data = {"body":msgBody,"queue_response" : False}
if responseHandler:
    data["queue_response"] = True

corrID = str(uuid.uuid4())

>>> channel.basic_publish(exchange='',routing_key='cn-dip-v3',properties=pika.BasicProperties(priority = 10, reply_to = callback_queue,correlation_id = corrID,),body=json.dumps(data))
>>> 

queue_declare有效。如果我删除它并运行相同的行,则定义队列。我在管理面板中看到它,奇怪的是,在端口55672而不是15672。

enter image description here enter image description here

此外,每次运行channel.basic_publish后,我都会看到另一个回调队列被添加到rabbitmq管理中的队列部分。

enter image description here

缺少的是要到达那里的信息。

1 个答案:

答案 0 :(得分:1)

您对端口的评论让我怀疑您有不同版本的消息代理正在运行。 Rabbit 3.0之前3.0版本的端口是55672. 3.0及更高版本有很大差异。