【发布时间】:2021-02-25 15:52:08
【问题描述】:
我在尝试使用 Rebus 响应 RabbitMQ 独占队列时遇到以下异常。
- e {"Queue 'xxxx-xxxx' does not exist"} Rebus.Exceptions.RebusApplicationException
+ InnerException {"The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=405, text=\"RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'xxxx-xxxx' in vhost '/'. It could be originally declared on another connection or the exclusive property value does not match that of the original d...\", classId=50, methodId=10, cause="} System.Exception {RabbitMQ.Client.Exceptions.OperationInterruptedException}
客户端将队列声明为独占,并且能够成功地将消息发送到服务器。服务器处理消息,但在发送响应时抛出异常。
我可以在 Rebus 源代码 (Rebus.RabbitMq.RabbitMqTransport.cs) 中看到它尝试了 model.QueueDeclarePassive(queueName),它会引发上述异常。
我找到了以下语句Here
RabbitMQ 将排他性扩展到 queue.declare(包括被动声明)、queue.bind、queue.unbind、queue.purge、queue.delete、basic.consume 和 basic.get
修改 Rebus 源以简单地从 CheckQueueExistence 方法返回 true 允许发送响应消息。所以我的问题是,这是 Rebus 中在排他队列上使用被动声明的问题,是 RabbitMQ 阻塞了调用,还是我缺少一个基本概念?
【问题讨论】: