Expressive middleware for queue workers
Task
A task is exposed to the middleware chain as this
. A task must implement
the following interface.
- value
- resolve
function (result) { /* ... */ }
- reject
function (error) { /* ... */ }
Optional methods can be attached to a task e.g.
- progress (firebase-queue)
- touch (nsq.js)
Example
firebase-queue
const xf = { return value progress resolve reject } { const start = next const ms = - start console} { thisresult = foo: 'bar' next} const ref = 'https://<your-firebase>.firebaseio.com/queue'const queue = ref
nsq.js
const xf = { return value: msg resolve: msgfinish reject: msgrequeue } { const start = next const ms = - start console} { thisresult = foo: 'bar' next} const reader = nsqreader