我在 RabbitMQ 服务器上指定了一个名为MyQueue
. 它经久耐用,并已x-dead-letter-exchange
设置为MyQueue.DLX
.
(我也有一个名为MyExchange
绑定到该队列的交换,另一个名为的交换MyQueue.DLX
,但我不认为这对这个问题很重要)
如果我使用 ruby 的amqp
gem 订阅这些消息,我会这样做:
# Doing this before and in a new thread has to do with how my code is structured
# shown here in case it has a bearing on the question
Thread.new do
AMQP.start('amqp://guest:guest@127.0.0.1:5672')
end
EventMachine.next_tick do
channel = AMQP::Channel.new(AMQP.connection)
queue = channel.queue("MyQueue", :durable => true, :'x-dead-letter-exchange' => "MyQueue.DLX")
queue.subscribe(:ack => true) do |metadata, payload|
p metadata
p payload
end
end
如果我使用已经创建和绑定的队列和交换器执行此代码(因为它们需要在我的设置中),那么 RabbitMQ 会在其日志中引发以下错误:
=ERROR REPORT==== 19-Aug-2013::14:25:53 ===
connection <0.19654.2>, channel 2 - soft error:
{amqp_error,precondition_failed,
"inequivalent arg 'x-dead-letter-exchange'for queue 'MyQueue' in vhost '/': received none but current is the value 'MyQueue.DLX' of type 'longstr'",
'queue.declare'}
这似乎是说我没有指定与预先存在的队列相同的死信交换 - 但我相信我有这queue = ...
条线。
有任何想法吗?