A Seneca.js job queue plugin
A plugin that allows you to create and use queues.
If you're using this module, and need help, you can:
If you are new to Seneca in general, please take a look at senecajs.org. We have everything from tutorials to sample apps to help get you up and running quickly.
To install, simply use npm. Remember you will need to install Seneca.js if you haven't already.
npm install seneca npm install seneca-queue
To run tests, simply use npm:
npm run test
Usage in the same process
var s =var assert =var task =task: 'my task'param: 42ssss
Usage in multiple processes
var s =sss
var s =sconsoles
var s =sconsoles
The tasks will be distributed among the servers in round robin. If a server fails to respond, it is blacklisted and won't receive any task (unless the requests are marked fatal$, in that case the instance will be closed as intended)
It is possible to pass additional options when registering the queue plugin, as shown below
var s =var assert =s
- role, default: 'queue'. This is the role to be used for start, stop and enqueue commands, you can change it in case of a conflict with other action patterns or if you want to register two different queues.
- concurrency, default: 1. How many task to process in parallel. Currently working only with the in-memory queue
seneca-queue provide a simple in-memory implementation, but more can be created. The implementation should add three "hook" actions to the seneca instance:
After the implementing plugin and actions are registered, seneca-queue will automatically recognize and start using it.
For examples see the in-memory implementation (https://github.com/senecajs/seneca-queue/blob/master/lib/memory.js) or the amazon sqs one (https://github.com/LucaLanziani/seneca-sqs-queue)
The Senecajs org encourages open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.
Copyright Matteo Collina and Senecajs.org contributors, 2015, Licensed under MIT.