ehsmsgqueue
v1.0.12
Published
EHS Message Queue
Downloads
4
Maintainers
Readme
End House Software Message Queue Module
End House Software Message Queue Module.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Prerequisites
The message queue module uses a MongoDB database to store data. You can create a MongoDB database by creating an account on Atlas.
In ehsmsgqueue.js you must edit the following source code line,
var uri = "mongodb+srv://username:[email protected]/dbname";
to reflect the database name, user name and password.
To run locally you need the NodeJS software installed (the npm package manager is bundled with NodeJS).
To edit source code, right-click on project's directoy, e.g ehsmsgqueue and select Open with Code menu option.
Deployment
Install message queue module in project ...
npm install --save ehsmsgqueue
and then ...
(a) Define Message Queue Variable
var mqueue = require('ehsmsgqueue');
(b) Init Message Queue
mqueue.initMsgQueues( msgQueueName, username,
function(err, result){
});
(c) Get a Message From the Queue
router.post('/getmsg', function(req, res) {
var msgQueueName = req.body.msgqueue;
var username = req.body.username;
mqueue.getMsg(msgQueueName,username,function(err, result){
res.send(result);
});
});
(d) Set a Message in the Queue
router.post('/setmsg', function(req, res) {
var msgQueueName = req.body.msgqueue;
var msg = req.body.msg;
mqueue.setMsg(msgQueueName,msg,function(err, result){
});
res.send("");
});
Built With
- Visual Studio Code - IDE enviroment.
- Atlas - MongoDB database.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning.
Authors
- Gavin Baker - Initial work - End House Software.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
First and foremost many thanks to the support of family and friends. Any code adapted from public available sources have the appropriate acknowledgements documented in source code comments.