Celery client for Node.js
Celery is an asynchronous task/job queue based on distributed
message passing. celery-shoot
allows to queue tasks from Node.js.
If you are new to Celery check out http://celeryproject.org/
node-celery
Differences with -
This library is now based on amqp-coffee, instead of node-amqp.
-
EventEmitter
based code has been removed; only pure callbacks are available. -
Support for the Redis Backend has been removed.
- I will accept pull-requests if you would like to re-add support.
-
Primary Queue / Exchange declaration has been removed. This means if you start up
celery-shoot
on a fresh RabbitMQ vhost, you'll get an error.To get around this, just start a
celery worker
on that vhost first.- Why? If you declared your Queues/Exchanges from node, you need to mirror
the celery settings exactly. If you don't, you need to stop both node &
celery, delete the queues, restart both services (with the correct settings,
or with the
celery worker
first). This was a big trap, that often came up deploying to production so we're better off without it!
- Why? If you declared your Queues/Exchanges from node, you need to mirror
the celery settings exactly. If you don't, you need to stop both node &
celery, delete the queues, restart both services (with the correct settings,
or with the
Usage
Simple example, included as examples/hello-world.js:
var celery = client = celery;
ETA
The ETA (estimated time of arrival) lets you set a specific date and time that is the earliest time at which your task will be executed:
var celery = client = celery;
Expiration
The expires argument defines an optional expiry time, a specific date and time using Date:
var celery = client = celery;
Routing
The simplest way to route tasks to different queues is using options.routes
:
var celery = client = celery;
You can also configure custom routers, similar to http://celery.readthedocs.org/en/latest/userguide/routing.html#routers
var { iftask === 'myapp.tasks.compress_video' return 'exchange': 'video' 'routingKey': 'video.compress' return null;};