我正在尝试向rabbitmq发布消息。这在生产环境env中使用相同的代码,因此我怀疑这是一个配置问题。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。在
另外,每次运行channel.basic_publish之后,我都会看到另一个回调队列被添加到rabbitmq管理中的queues部分。在
唯一缺少的就是到达那里的信息。在