0

バニーで遊んでいて、メッセージを既存のキューに発行しようとしています。残念ながら、Bunny の内部ドキュメントは、コンシューマの作成には有効ですが、produser には有効ではありません。たとえば、ある取引所にバインドしようとすると、エラーがスローされます

PRECONDITION_FAILED - cannot redeclare exchange 'test' in vhost '/' with different type, durable, internal or autodelete value

コード:

conn = Bunny.new()
conn.start
ch = conn.create_channel
x = ch.direct("test")

なぜ再宣言しようとしているのか知っていますか。

たぶん、最初にキューにバインドする必要がありますか?

助けてくれてありがとう。

4

2 に答える 2

0

I've ran into this problem too. If you've already setup the exchange in RabbitMQ. Make sure that you bind the exchange to your queue. You can either do that in the RabbitMQ admin or via the command line using the rabbitmqctl command.

Next, verify that the exchange you are using is a "direct" exchange. By default, when creating an exchange in the RabbitMQ admin it will generate a "topic" exchange. After you verify they are the same, then you should not get the error message.

于 2016-01-25T17:19:33.470 に答える