我正在使用rabbitmq topic exchange来消费从客户端推送的消息。因此,我创建了一个队列并将队列绑定到默认的exchange amq.topic。
amqp.connect(uri, (error0, connection) => {
if (error0) {
throw error0;
}
connection.createChannel((error1, channel) => {
if (error1) {
throw error1;
}
channel.assertExchange(exchange, 'topic', {
durable: true
});
channel.assertQueue('', { durable: true });
channel.bindQueue('queue1', exchange, key);
try {
channel.consume('queue1', msg => {
if (msg !== null) {
console.log(" [x] %s:'%s'", msg.fields.routingKey, msg.content.toString());
}
}, { noAck: true },);但是,amqp每次连接并消费消息时,都会创建一个Temporary queues,但没有删除?
当我有一个队列时,为什么要创建消耗时间中的临时队列?以及如何避免创建?

发布于 2019-10-14 20:16:26
当您试图声明一个具有空白名称的队列时,将生成具有随机名称的队列amq.gen-*。这里的问题是您传递的是空值作为队列名称。将相同的内容更改为下面。
channel.assertQueue('demo-queue', { durable: true });
有关详细信息,请参阅https://www.rabbitmq.com/tutorials/tutorial-one-javascript.html
https://stackoverflow.com/questions/58373934
复制相似问题