【发布时间】:2020-05-19 07:18:42
【问题描述】:
我有一个正在运行的 rabitmq 服务器,它有一个队列。我在队列中发布了一些数据。现在,如果当时处理该消息有一些错误,那么我将其拒绝为ch.reject(msg,true)。所以消息再次被消费它再次是错误然后再次拒绝它&消息将再次被消费。现在我想知道该消息已经发送,因为我拒绝了它。
const queueresponse = await self.filterData(JSON.parse(msg.content.toString()));
if (queueresponse) {
ch.ack(msg);
console.log("queue received true")
} else {
ch.reject(msg, true);
console.log("queue received false")
}
有没有办法知道消费的消息是否因为被拒绝而早先发送了?
【问题讨论】:
标签: javascript node.js rabbitmq queue