Skip to content

Instantly share code, notes, and snippets.

@anymaniax
Created June 2, 2017 11:15
Show Gist options
  • Save anymaniax/dbe71e4a30d12c6c86d5f92a9b95dfbd to your computer and use it in GitHub Desktop.
Save anymaniax/dbe71e4a30d12c6c86d5f92a9b95dfbd to your computer and use it in GitHub Desktop.
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