Instantly share code, notes, and snippets.

Embed
What would you like to do?
Switching from cluster module to PM2 & RabbitMQ
// exports RabbitMQ connection
const MQ = require('./rabbitmq-config');
global.smsWorker = {
send: function (message) {
// publish message on sms exchange
return MQ.publish('sms', message);
}
};
global.emailWorker = {
send: function (message) {
// publish message on email exchange
return MQ.publish('email', message);
}
};
global.notifWorker = {
send: function (message) {
// publish message on notif exchange
return MQ.publish('notif', message);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment