quest-js
v0.1.0
Published
Simple and reliable distributed task processing library for Node JS.
Downloads
3
Maintainers
Readme
quest-js
Quest JS is a simple and reliable distributed task processing library for Node JS.
Installation
$ npm install quest-js
Usage
Create example.js
// worker.js
const { QuestApp, AMQPBroker } = require('quest-js');
const quest = new QuestApp(new AMQPBroker());
// Defines the message receiver
const greet = quest.task()((person) => {
console.log(`Hi ${person}!`);
});
// Workers need the handler code so we export the app instance
exports.questApp = quest;
const main = async () => {
// Pushes a new message to workers
await greet.send('Alice');
await quest.broker.close();
};
main();
Launch worker
$ quest-worker ./example
Send a message
$ node ./example.js
Running node tests
Install dependencies:
$ npm install
$ npm test
License
MIT