-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathamqp.js
More file actions
20 lines (18 loc) · 664 Bytes
/
amqp.js
File metadata and controls
20 lines (18 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var amqp = require('amqplib/callback_api');
module.exports = {
// connects to rabbitmq
connect: (callback) => {
amqp.connect('amqp://localhost', function (err, conn) {
// this function will be called when the connection is created
// `err` will contain the error object, if any errors occurred
// `conn` will contain the connection object
if (err != null) bail(err); // calls `bail` function if an error occurred when connecting
callback(conn); // callback
});
},
bail: (err) => {
console.error(err);
process.exit(1);
},
getQueue: () => "tasks"
}