Skip to content

Instantly share code, notes, and snippets.

@kuno
Created April 8, 2013 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuno/5335150 to your computer and use it in GitHub Desktop.
Save kuno/5335150 to your computer and use it in GitHub Desktop.
var amqp = require('amqp');
var connection = amqp.createConnection({ host: '127.0.0.1' });
// Wait for connection to become established.
connection.on('ready', function () {
console.log('connection ready');
// Use the default 'amq.topic' exchange
connection.queue('logger', function(q){
console.log('queue ready');
// Bind this queue to exchange 'devops' with route key 'log'
q.bind('devops','log');
//console.log(q);
// Receive messages
q.subscribe(function (message) {
// Print messages to stdout
console.log(message);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment