Created
June 2, 2017 11:15
-
-
Save anymaniax/dbe71e4a30d12c6c86d5f92a9b95dfbd to your computer and use it in GitHub Desktop.
This file contains 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('amqplib/callback_api'); | |
amqp.connect('amqp://localhost', function(err, conn) { | |
conn.createChannel(function(err, ch) { | |
var q = 'task_queue'; | |
var msg = "Hello World!"; | |
ch.assertQueue(q, {durable: true}); | |
ch.sendToQueue(q, new Buffer(msg), {persistent: true}); | |
console.log(" [x] Sent '%s'", msg); | |
}); | |
setTimeout(function() { conn.close(); process.exit(0) }, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment