Skip to content

Instantly share code, notes, and snippets.

@shapeshed
Created February 27, 2013 11:00
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 shapeshed/5047117 to your computer and use it in GitHub Desktop.
Save shapeshed/5047117 to your computer and use it in GitHub Desktop.
var amqp = require('amqp');
var connection = amqp.createConnection({});
connection.on('ready', function () {
'use strict';
connection.exchange('chat', {type: 'topic'}, function(exchange) {
connection.queue( 'users', function (queue) {
queue.bind(exchange, 'users.*', function(q) {
q.subscribe(function (message, headers, deliveryInfo) {
console.log(headers);
console.log(deliveryInfo);
console.log(JSON.stringify(message));
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment