Last active
July 5, 2018 02:57
-
-
Save WaleedAshraf/7746c51769318ad8b32a92a80fdb7cee to your computer and use it in GitHub Desktop.
Switching from cluster module to PM2 & RabbitMQ
This file contains hidden or 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
// 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