Created
March 8, 2016 01:14
-
-
Save AGhost-7/ae89aaa711ea3572a70b to your computer and use it in GitHub Desktop.
This file contains hidden or 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'); | |
| 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(); |
This file contains hidden or 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'); | |
| 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