Does anyone have an example of creating a topic exchange in Node-amqp? I've already gone through https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/javascript-nodejs but unfortunately it doesn't recreate tutorials 4+ from the RabbitMQ website.
问问题
4928 次
1 回答
4
这可能是一个过于简单的答案,但在基本层面上它是可行的......
var amqp = require('amqp');
var connection = amqp.createConnection({ host: '127.0.0.1' });
connection.on('ready', function () {
var exchange = connection.exchange('my-super-xchange', {type: 'topic'});
exchange.on('open', function(){
console.log('Lets do this!');
})
})
一旦你运行了上面的,交换现在应该在你的 rabbitMQ 实例上可见
$ rabbitmqctl list_exchanges
Listing exchanges ...
direct
amq.direct direct
amq.fanout fanout
amq.headers headers
amq.match headers
amq.rabbitmq.log topic
amq.rabbitmq.trace topic
amq.topic topic
dingo topic
my-super-xchange topic
...done.
于 2013-08-30T09:07:50.403 回答