Created
April 21, 2015 12:36
-
-
Save ShawInnes/533eec07bfa30d4288d2 to your computer and use it in GitHub Desktop.
Node.js MassTransit Listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var amqp = require('amqp'); | |
console.log('create connection'); | |
var connection = amqp.createConnection({ host: '10.0.1.59' }); | |
console.log('done'); | |
// Wait for connection to become established. | |
connection.on('ready', function () { | |
// Use the default 'amq.topic' exchange | |
connection.queue('nodequeue', { durable: false }, function (q) { | |
q.bind('blipper','#'); | |
q.subscribe(function (message, headers, deliveryInfo, messageObject) { | |
//console.log('----- headers -----'); | |
//console.log(headers); | |
//console.log('----- messageObject -----'); | |
//console.log(messageObject); | |
console.log('----- deliveryInfo -----'); | |
console.log(deliveryInfo); | |
var decoded = JSON.parse(message.data.toString('utf8')); | |
console.log('----- decoded -----'); | |
console.log(decoded); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment