【发布时间】:2022-11-27 00:05:27
【问题描述】:
如何使用 NestJS 设置 rabbitMQ 连接名称以便它显示在管理控制台上?我在 RmqOptions 界面中看不到任何选项。
我想像这篇文章中那样为连接设置友好名称: Set connection name with amqplib
我在网上做了一些研究。参考 NestJS 文档并查看代码。
【问题讨论】:
如何使用 NestJS 设置 rabbitMQ 连接名称以便它显示在管理控制台上?我在 RmqOptions 界面中看不到任何选项。
我想像这篇文章中那样为连接设置友好名称: Set connection name with amqplib
我在网上做了一些研究。参考 NestJS 文档并查看代码。
【问题讨论】:
this.app.connectMicroservice<MicroserviceOptions>(
{
transport: Transport.RMQ,
options: {
queue: this.queueName,
urls: [this.host],
prefetchCount: 1,
headers: {
['state']: 'initial',
},
noAck: false,
noAssert: true,
persistent: true,
queueOptions: {
durable: false,
messageTtl: 700,
} as AmqplibQueueOptions,
socketOptions: {
clientProperties: {
connection_name: '<NAME_YOUR_CONNECTION_HERE>',
},
} as AmqpConnectionManagerSocketOptions,
},
},
{ inheritAppConfig: true },
)
【讨论】: