We are trying to build a chat application with nodejs , rabbitmq and mongodb. For faster delivery of messages , we are using rabbitmq . Since I am new to this concept, if anybody can, kindly help me out. I am using the node amqp module to connect to the rabbitmq server(https://www.npmjs.org/package/amqp) .
I am declaring an exchange as given below :
var amqp = require('amqp');var amqpconnection = amqp.createConnection({host: 'localhost'});var exchange = amqpconnection.exchange('Exchange',{confirm:true,type:"direct", durable:true, autoDelete:false},function (exchange){});
I am publishing a message using the below method :
exchange.publish('receiver_queue', message ,{persistent: true,mandatory:true},function(data){console.log("Message Published");console.log(data);});
My question is , when I am publishing to a queue that already exists , in the publish callback , we get a 'false' response but when I am publishing to a queue that doesn't exist at all , in the publish callback , still we get a 'false' response ; Why is it so ? Is there any method by which I can check whether a queue exists before publishing to it ?