Skip to content

Instantly share code, notes, and snippets.

@AGhost-7
Created March 8, 2016 01:14
Show Gist options
  • Select an option

  • Save AGhost-7/ae89aaa711ea3572a70b to your computer and use it in GitHub Desktop.

Select an option

Save AGhost-7/ae89aaa711ea3572a70b to your computer and use it in GitHub Desktop.
var amqp = require('amqp');
var con = amqp.createConnection({ host: 'localhost' });
console.log('created connection instance');
con.on('ready', function() {
console.log('ready');
con.queue('ping', function(q) {
console.log('listening to queue ping');
q.bind('#');
q.subscribe(function(message) {
console.log('arguments:', arguments);
});
});
});
con.on('error', function(err) {
console.log('error:', err);
});
process.stdin.resume();
var amqp = require('amqp');
var con = amqp.createConnection({}, {
defaultExchangeName: 'amq.topic'
});
con.on('ready', function() {
con.publish('ping', { pong: 'pong' }, {}, function() {
console.log('ping callback:', arguments);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment