Skip to content

Instantly share code, notes, and snippets.

@WaleedAshraf
Last active July 5, 2018 02:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WaleedAshraf/7746c51769318ad8b32a92a80fdb7cee to your computer and use it in GitHub Desktop.
Save WaleedAshraf/7746c51769318ad8b32a92a80fdb7cee to your computer and use it in GitHub Desktop.
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