Do I really need to instantiate the queue "queue = connection.queue(...)" every time I want to use it?
服务器(node.js):
queue = connection.queue( incoming , { // <--- DO I REALLY NEED THAT FOR EVERY REQUEST?
durable : true,
exclusive : false }, function() {});
queue.subscribe(function(msg) {
// Unsubcribe here. Maybe there is something like a once listener?
console.log("RECEIVED: "+msg)
//res.send(msg.data);
queue.unsubscribe(ctag);
res.redirect( /home );
}).addCallback(function(ok) { ctag = ok.consumerTag; });
exchange.publish( msg_queue , functional! , { // request
replyTo: incoming
});
如果queue = 链接.queue(......);
与服务器一起即时发出,使用查询组的第一个请求是成功的,但以下请求却有误:
Error: NOT_FOUND - no queue incoming in vhost /
at Queue._onMethod (/Users/cassiomelo/code/cubix/cubix_nodejs/node_modules/amqp/amqp.js:1720:15)