All Projects → mher → Node Celery

mher / Node Celery

Licence: other
Celery client for Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Node Celery

Machinery
Machinery is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 5,821 (+798.3%)
Mutual labels:  task, redis, rabbitmq, queue, amqp
celery.node
Celery task queue client/worker for nodejs
Stars: ✭ 164 (-74.69%)
Mutual labels:  queue, amqp, background-jobs, celery
Yii Queue
Queue extension for Yii 3.0
Stars: ✭ 38 (-94.14%)
Mutual labels:  redis, rabbitmq, queue, amqp
leek
Celery Tasks Monitoring Tool
Stars: ✭ 77 (-88.12%)
Mutual labels:  task, queue, rabbitmq, celery
Yii2 Queue
Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman
Stars: ✭ 977 (+50.77%)
Mutual labels:  redis, rabbitmq, queue, amqp
Fastapi Celery
Minimal example utilizing fastapi and celery with RabbitMQ for task queue, Redis for celery backend and flower for monitoring the celery tasks.
Stars: ✭ 154 (-76.23%)
Mutual labels:  redis, rabbitmq, celery
Enqueue Dev
Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
Stars: ✭ 1,977 (+205.09%)
Mutual labels:  redis, rabbitmq, amqp
Qutee
PHP Background Jobs (Tasks) Manager
Stars: ✭ 63 (-90.28%)
Mutual labels:  background-jobs, redis, queue
Ytask
YTask is an asynchronous task queue for handling distributed jobs in golang(go异步任务框架)
Stars: ✭ 121 (-81.33%)
Mutual labels:  task, queue, celery
Garagemq
AMQP message broker implemented with golang
Stars: ✭ 153 (-76.39%)
Mutual labels:  rabbitmq, queue, amqp
Fennel
A task queue library for Python and Redis
Stars: ✭ 24 (-96.3%)
Mutual labels:  task, redis, queue
dispatcher
Dispatcher is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 60 (-90.74%)
Mutual labels:  queue, amqp, celery
Yii2 Async
Provides translucent api & queues for moving large tasks out of request context with SQL, Redis or AMQP.
Stars: ✭ 64 (-90.12%)
Mutual labels:  redis, queue, amqp
Springboot Learn
🌹springboot常用框架整合示例,涉及多种网站监控,数据缓存,网络通信,持久层,权限管理,常用工具等
Stars: ✭ 270 (-58.33%)
Mutual labels:  task, redis, rabbitmq
Rusty Celery
🦀 Rust implementation of Celery for producing and consuming background tasks
Stars: ✭ 243 (-62.5%)
Mutual labels:  redis, rabbitmq, celery
Rq
Simple job queues for Python
Stars: ✭ 8,065 (+1144.6%)
Mutual labels:  task, background-jobs, redis
Laravel Queue Rabbitmq
RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
Stars: ✭ 1,175 (+81.33%)
Mutual labels:  rabbitmq, queue, amqp
python-asynchronous-tasks
😎Asynchronous tasks in Python with Celery + RabbitMQ + Redis
Stars: ✭ 37 (-94.29%)
Mutual labels:  queue, rabbitmq, celery
Clearly
Clearly see and debug your celery cluster in real time!
Stars: ✭ 287 (-55.71%)
Mutual labels:  task, queue, celery
Flower
Real-time monitor and web admin for Celery distributed task queue
Stars: ✭ 5,036 (+677.16%)
Mutual labels:  redis, rabbitmq, celery

Celery client for Node.js

NPM Version Downloads

Celery is an asynchronous task/job queue based on distributed message passing. node-celery allows to queue tasks from Node.js. If you are new to Celery check out http://celeryproject.org/

Usage

Simple example, included as examples/hello-world.js:

var celery = require('node-celery'),
	client = celery.createClient({
		CELERY_BROKER_URL: 'amqp://guest:[email protected]:5672//',
		CELERY_RESULT_BACKEND: 'amqp://'
	});

client.on('error', function(err) {
	console.log(err);
});

client.on('connect', function() {
	client.call('tasks.echo', ['Hello World!'], function(result) {
		console.log(result);
		client.end();
	});
});

Note: When using AMQP as result backend with celery prior to version 3.1.7 the result queue needs to be non durable or it will fail with a: Queue.declare: (406) PRECONDITION_FAILED.

var celery = require('node-celery'),
	client = celery.createClient({
		CELERY_TASK_RESULT_DURABLE: false
	});

For RabbitMQ backends, the entire broker options can be passed as an object that is handed off to AMQP. This allows you to specify parameters such as SSL keyfiles, vhost, and connection timeout among others.

var celery = require('node-celery'),
	client = celery.createClient({
		CELERY_BROKER_OPTIONS: {
			host: 'localhost',
			port: '5672',
			login: 'guest',
			password: 'guest',
			authMechanism: 'AMQPLAIN',
			vhost: '/',
			ssl: {
				enabled: true,
				keyFile: '/path/to/keyFile.pem',
				certFile: '/path/to/certFile.pem',
				caFile: '/path/to/caFile.pem'
			}
		},
		CELERY_RESULT_BACKEND: 'amqp'
	});

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 = require('node-celery'),
	client = celery.createClient({
		CELERY_BROKER_URL: 'amqp://guest:[email protected]:5672//',
	});

client.on('connect', function() {
	client.call('send-email', {
		to: '[email protected]',
		title: 'sample email'
	}, {
		eta: new Date(Date.now() + 60 * 60 * 1000) // an hour later
	});
});

Expiration

The expires argument defines an optional expiry time, a specific date and time using Date:

var celery = require('node-celery'),
	client = celery.createClient({
		CELERY_BROKER_URL: 'amqp://guest:[email protected]:5672//',
	});

client.on('connect', function() {
	client.call('tasks.sleep', [2 * 60 * 60], null, {
		expires: new Date(Date.now() + 60 * 60 * 1000) // expires in an hour
	});
});

Backends

The backend is used to store task results. Currently AMQP (RabbitMQ) and Redis backends are supported.

var celery = require('node-celery'),
	client = celery.createClient({
		CELERY_BROKER_URL: 'amqp://guest:[email protected]:5672//',
		CELERY_RESULT_BACKEND: 'redis://localhost/0'
	});

client.on('connect', function() {
	var result = client.call('tasks.add', [1, 2]);
	setTimeout(function() {
		result.get(function(data) {
			console.log(data); // data will be null if the task is not finished
		});
	}, 2000);
});

AMQP backend allows to subscribe to the task result and get it immediately, without polling:

var celery = require('node-celery'),
	client = celery.createClient({
		CELERY_BROKER_URL: 'amqp://guest:[email protected]:5672//',
		CELERY_RESULT_BACKEND: 'amqp'
	});

client.on('connect', function() {
	var result = client.call('tasks.add', [1, 2]);
	result.on('ready', function(data) {
		console.log(data);
	});
});

Routing

The simplest way to route tasks to different queues is using CELERY_ROUTES configuration option:

var celery = require('node-celery'),
	client = celery.createClient({
		CELERY_BROKER_URL: 'amqp://guest:[email protected]:5672//',
		CELERY_ROUTES: {
			'tasks.send_mail': {
				queue: 'mail'
			}
		}
	}),
	send_mail = client.createTask('tasks.send_mail'),
	calculate_rating = client.createTask('tasks.calculate_rating');

client.on('error', function(err) {
	console.log(err);
});

client.on('connect', function() {
	send_mail.call([], {
		to: '[email protected]',
		title: 'hi'
	}); // sends a task to the mail queue
	calculate_rating.call([], {
		item: 1345
	}); // sends a task to the default queue
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].