All Projects β†’ mugli β†’ orkid-node

mugli / orkid-node

Licence: MIT license
Reliable and modern Redis Streams based task queue for Node.js πŸ€–

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
HTML
75241 projects

Projects that are alternatives of or similar to orkid-node

celery.node
Celery task queue client/worker for nodejs
Stars: ✭ 164 (+168.85%)
Mutual labels:  queue, job-queue, task-queue, worker-queue
Bee Queue
A simple, fast, robust job/task queue for Node.js, backed by Redis.
Stars: ✭ 2,685 (+4301.64%)
Mutual labels:  job-scheduler, job-queue, worker-queue, redis-queue
Bull
Premium Queue package for handling distributed jobs and messages in NodeJS.
Stars: ✭ 11,748 (+19159.02%)
Mutual labels:  queue, job, message-queue, job-queue
psched
Priority-based Task Scheduling for Modern C++
Stars: ✭ 59 (-3.28%)
Mutual labels:  queue, task-scheduler, task-queue
comrade-dev
Comrade is a job scheduler&manager service.
Stars: ✭ 69 (+13.11%)
Mutual labels:  job, job-scheduler, job-queue
Go Quartz
Simple, zero-dependency scheduling library for Go
Stars: ✭ 118 (+93.44%)
Mutual labels:  job, job-scheduler, job-queue
nest-queue
Queue manager for NestJS Framework for Redis (via bull package)
Stars: ✭ 69 (+13.11%)
Mutual labels:  queue, job, job-scheduler
yerbie
A blazing fast job queue built for ease of use and scalability
Stars: ✭ 16 (-73.77%)
Mutual labels:  queue, job-scheduler, job-queue
tasq
A simple task queue implementation to enqeue jobs on local or remote processes.
Stars: ✭ 83 (+36.07%)
Mutual labels:  queue, job-scheduler, task-queue
theeye-of-sauron
TheEye Dockers and QuickStart
Stars: ✭ 27 (-55.74%)
Mutual labels:  queue, task-scheduler, task-queue
Taskq
Golang asynchronous task/job queue with Redis, SQS, IronMQ, and in-memory backends
Stars: ✭ 555 (+809.84%)
Mutual labels:  queue, message-queue, task-queue
Workq
Job server in Go
Stars: ✭ 1,546 (+2434.43%)
Mutual labels:  queue, job, job-scheduler
Resque
Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.
Stars: ✭ 9,031 (+14704.92%)
Mutual labels:  queue, job-scheduler, job-queue
Swiftqueue
Job Scheduler for IOS with Concurrent run, failure/retry, persistence, repeat, delay and more
Stars: ✭ 276 (+352.46%)
Mutual labels:  queue, job, job-scheduler
Ytask
YTask is an asynchronous task queue for handling distributed jobs in golang(goεΌ‚ζ­₯δ»»εŠ‘ζ‘†ζžΆοΌ‰
Stars: ✭ 121 (+98.36%)
Mutual labels:  queue, job, task-scheduler
Redis Smq
A simple high-performance Redis message queue for Node.js.
Stars: ✭ 230 (+277.05%)
Mutual labels:  queue, message-queue, job-queue
qless-php
PHP Bindings for qless
Stars: ✭ 25 (-59.02%)
Mutual labels:  queue, redis-queue
ifto
A simple debugging module for AWS Lambda (Ξ») timeout
Stars: ✭ 72 (+18.03%)
Mutual labels:  typescript-library, node-js
queue
A task queue library for Go.
Stars: ✭ 26 (-57.38%)
Mutual labels:  queue, task-queue
core
Simple JSON-based messaging queue for inter service communication
Stars: ✭ 28 (-54.1%)
Mutual labels:  message-queue, redis-queue


orkid

NPM version Build Status Code Coverage Dependencies Dev Dependencies Required Node License

Reliable and modern Redis-Streams based task queue for Node.js.


Screenshot

screenshot


Table of Contents


Features

  • Orkid lets Redis do the heavy lifting with Redis-Streams.
  • Adjustable concurrency per consumer instance for scaling task processing. See example code. See example code.
  • Job timeouts and retries. All configurable per consumer. See example code.
  • Task Deduplication. If a task is already waiting in the queue, it can be configured to avoid queueing the same task again. (Useful for operations like posting database record updates to elasticsearch for re-indexing. Deduplication is a common pattern here to avoid unnecessary updates). See example code.
  • Add tasks in bulk in one call. The producer will handle chunking and optimize round-trips to redis using pipelining.
  • Monitoring and management UI for better visibility.
  • Rate-limiting workers. (work in progress)

Requirements

  • Node.js >= 10
  • Redis >= 5

πŸ‘ Important: Redis-Streams feature is not available before Redis version 5.


Install

npm install orkid --save

Examples

Basic example of producing and consuming tasks:

Producing tasks:

const { Producer } = require('orkid');

// `basic` is the queue name here
//  We'll use the same name in the consumer to process this task
const producer = new Producer('basic');

async function addTasks() {
  for (let i = 0; i < 10; i++) {
    console.log('Adding task ', i);
    await producer.addTask(i);
  }
}

addTasks()
  .then(() => {
    console.log('Done');
    process.exit(); // To disconnect from redis
  })
  .catch(e => console.error(e));

Consuming tasks:

const { Consumer } = require('orkid');

// Worker Function
async function workerFn(data, metadata) {
  let result;
  /*
    Do operation on `data` here
    and store the result in `result` variable

    Anything you return from this function will
    be saved in redis and can be viewed in the Orkid UI.

    Returning nothing is fine too.

    Throwing error will mark the job as failed,
    which can be retried too.
  */

  console.log('Task done!');
  return result;
}

// Consume task from the `basic` queue
const consumer = new Consumer('basic', workerFn);

// Start processing tasks!
// Important: Until you call this method, orkid consumer will do nothing.
consumer.start();

πŸ‘ More examples are available in the ./examples directory, including how to do task de-duplication, retry on failure, timeout etc. πŸ‘


API Documentation

API Documentation is available here.


Monitoring and Management UI/Admin Panel

screenshot screenshot

You need to run orkid-ui separately for the dashboard. Detail instructions on how to run orkid-ui locally or in production using docker/docker-compose can be found here: https://github.com/mugli/orkid-ui#running-locally


Task/job life-cycle

[TODO: Add a flowchart here]


FAQ

Is this production ready? This project is under active development right now. API WILL introduce breaking changes until we reach version 1.0. After that semantic versioning will be followed.

Why a new job queue for Node.js? - All the redis-based solutions were created before Redis-Streams (https://redis.io/topics/streams-intro) became available. They all require a lot of work on the queue-side to ensure durability and atomicity of jobs handling operations. Redis-Streams was specifically designed to made this kind of tasks easier, thus allows simpler core in the queue and more reliable and maintainable operations.
- None of existing usable job queues in Node.js offers a monitoring option that we liked.
- None of the existing usable task queues support task de-duplication.

How do I set priority in the tasks? Redis-Streams isn't a right primitive to make a priority queue efficiently on top of it. Orkid doesn't support priority queues now and probably never will.
However, as a workaround, you can create a separate queue, keep its workload minimal and use it for high priority jobs with Orkid.

What is the order of job/task delivery? Jobs are processed in the order they are produced. However, if retry option is turned on and is applicable, failed jobs gets enqueued to the queue at once, along with other newly produced jobs.


Maintainer(s)


License

MIT


Related Projects

  • orkid-ui: Dashboard to monitor and manage Orkid task queue.
  • orkid-api: GraphQL API to monitor and manage Orkid task queue (used internally by orkid-ui).
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].