Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created July 7, 2014 09:21
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 michaelklishin/5d951eda6fb84f88eca2 to your computer and use it in GitHub Desktop.
Save michaelklishin/5d951eda6fb84f88eca2 to your computer and use it in GitHub Desktop.
var q = "rabbit-events";
var open = require('amqplib').connect('amqp://localhost');
// Consumer
open.then(function(conn) {
var ok = conn.createChannel();
ok = ok.then(function(ch) {
ch.assertQueue(q);
ch.bindQueue(q, "amq.rabbitmq.event", "#");
ch.consume(q, function(msg) {
if (msg !== null) {
console.log(msg.content.toString());
ch.ack(msg);
}
});
});
return ok;
}).then(null, console.warn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment