change msg var scope

This commit is contained in:
Giuseppe Privitera 2015-08-04 11:05:38 +01:00
parent bf939e33ea
commit 6f6be60301

View File

@ -13,9 +13,10 @@ function createChannel(conn) {
function logMessage(ch) {
var ex = 'logs';
var ok = ch.assertExchange(ex, 'fanout', {durable: false})
var msg = process.argv.slice(2).join(' ') || 'Hello World!';
return ok.then(function() {
var msg = process.argv.slice(2).join(' ') || 'Hello World!';
ch.publish(ex, '', new Buffer(msg));
console.log(" [x] Sent '%s'", msg);
return ch.close();