worque
AMQP-based work queue.
Installation
npm i worque --save
Description
Each task
= queue
.
Publishing message = loading single worker with task.
NOTE: one-by-one task processing is guaranteed only with RabbitMQ 3.3 and higher.
Motivation
- simple project bootstrap
- task survives broker restarts
- task waits for worker (handler) if it's offline
- task can be scheduled (cron)
- task can be retried with flexible and easy-to-specify retry period configuration
- fluent and simple API
Example
var client = 'amqp://localhost'; // global (all tasks) eventsclient; // fired before handlerclient; // fired after handlerclient; // fired if handler fails // define task 'logthis' and provide handler; // start 'logthis' task with params; // setup scheduled task; // will be retried (republished) 1 second after 1st failure// 2 seconds after 2nd failure// 3 seconds after 3d failure; process;
License
MIT