每次我将 AMQP 队列绑定到交换器时,它似乎都会自动绑定到“默认”直接交换器。
这是使用rabbitMQ服务器和node.js的代码:
var amqp = require('amqp');
var connection = amqp.createConnection({host:'localhost'});
connection.on('ready', function(){
var q = connection.queue('test_queue_name');
var exc = connection.exchange('test_exchange', { autoDelete:true });
q.bind('test_exchange', 'test.key');
});
这是使用“rabbitmqctl list_bindings”命令时的控制台输出:
Listing bindings ...
exchange test_queue_name queue test_queue_name []
test_exchange exchange test_queue_name queue test.key []
...done.