Created
May 25, 2017 05:10
-
-
Save nrempel/061cdc5ccdbe35faac0947877e8be555 to your computer and use it in GitHub Desktop.
Example code for https://rempel.world/guides/docker-development-environment.html Raw Raw Raw
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
const amqp = require('amqplib/callback_api'); | |
amqp.connect(process.env.RABBIT_URL, (err, conn) => { | |
conn.createChannel((err, ch) => { | |
// Consume messages from web queue | |
var q1 = 'web'; | |
ch.assertQueue(q1, { durable: false }); | |
ch.consume(q1, (msg) => { | |
console.info('Message received from web process:', msg.content.toString()); | |
}, {noAck: true}); | |
// Consume messages from clock queue | |
var q2 = 'clock'; | |
ch.assertQueue(q2, { durable: false }); | |
ch.consume(q2, (msg) => { | |
console.info('Message received from clock process:', msg.content.toString()); | |
}, {noAck: true}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment