使用 amqplib 设置连接名称

问题描述

我需要为我的连接设置一个友好的名称,如下所示,而不是“?”在用于 NodeJS 的 amqplib 的 RabbitMQ 中:

enter image description here

我找到了 Java 和 Python 的例子,但这个库还没有。谢谢。

解决方法

是的,您可以通过在客户端属性中传递连接名称来设置它:

amqp.connect('amqp://localhost',{clientProperties: {connection_name: "myFriendlyName"}})

enter image description here

供参考:

https://github.com/squaremo/amqp.node/issues/217