/home/repo/404hound/node_modules/amqp/amqp.js:1229
this.channels[channel] = exchange;
^
TypeError: Cannot set property '1' of undefined
The solution is to wait until the connection is ready before invoking any start functions:
var conn = createConnection();
conn.on('ready', function () {
conn.exchange(config.exchangeName, function (exchange) {
console.log("Starting...");
conn.queue(config.queueName, {durable:true, exclusive:true},
function (q) {
q.bind(config.exchangeName, '#'); //subscribe to all messages.
q.subscribe(function (msg) {
console.log(msg);
});
});
});
});
No comments:
Post a Comment