All Projects → owl1n → nest-queue

owl1n / nest-queue

Licence: MIT license
Queue manager for NestJS Framework for Redis (via bull package)

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to nest-queue

Bull
Bull module for Nest framework (node.js) 🐮
Stars: ✭ 356 (+415.94%)
Mutual labels:  queue, job, nest, nestjs
Swiftqueue
Job Scheduler for IOS with Concurrent run, failure/retry, persistence, repeat, delay and more
Stars: ✭ 276 (+300%)
Mutual labels:  queue, job, job-scheduler
Workq
Job server in Go
Stars: ✭ 1,546 (+2140.58%)
Mutual labels:  queue, job, job-scheduler
orkid-node
Reliable and modern Redis Streams based task queue for Node.js 🤖
Stars: ✭ 61 (-11.59%)
Mutual labels:  queue, job, job-scheduler
rust-sidekiq
Rust Sidekiq Client
Stars: ✭ 24 (-65.22%)
Mutual labels:  queue, job
linda
Linda is a simple dispatcher library.
Stars: ✭ 12 (-82.61%)
Mutual labels:  queue, job
nestjs-ratelimiter
Distributed consistent flexible NestJS rate limiter based on Redis
Stars: ✭ 49 (-28.99%)
Mutual labels:  nest, nestjs
wtsqs
Simplified Node AWS SQS Worker Wrapper
Stars: ✭ 18 (-73.91%)
Mutual labels:  queue, job
Resque
Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.
Stars: ✭ 9,031 (+12988.41%)
Mutual labels:  queue, job-scheduler
Pg Boss
Queueing jobs in Node.js using PostgreSQL like a boss
Stars: ✭ 525 (+660.87%)
Mutual labels:  queue, job
Ytask
YTask is an asynchronous task queue for handling distributed jobs in golang(go异步任务框架)
Stars: ✭ 121 (+75.36%)
Mutual labels:  queue, job
Bull
Premium Queue package for handling distributed jobs and messages in NodeJS.
Stars: ✭ 11,748 (+16926.09%)
Mutual labels:  queue, job
MyAPI
A template to create awesome APIs easily ⚡️
Stars: ✭ 117 (+69.57%)
Mutual labels:  nest, nestjs
egg-bus
🐣 用 egg 编写优雅的队列与事件
Stars: ✭ 38 (-44.93%)
Mutual labels:  queue, bull
yerbie
A blazing fast job queue built for ease of use and scalability
Stars: ✭ 16 (-76.81%)
Mutual labels:  queue, job-scheduler
Node Rethinkdb Job Queue
A persistent job or task queue backed by RethinkDB.
Stars: ✭ 158 (+128.99%)
Mutual labels:  queue, job
legacy-bottlerockets
Node.js high availability queue and scheduler for background job processing
Stars: ✭ 25 (-63.77%)
Mutual labels:  queue, job
tasq
A simple task queue implementation to enqeue jobs on local or remote processes.
Stars: ✭ 83 (+20.29%)
Mutual labels:  queue, job-scheduler
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+1878.26%)
Mutual labels:  queue, job-scheduler
Aint Queue
🚀 An async-queue library built on top of swoole, flexable multi-consumer, coroutine supported. 基于 Swoole 的一个异步队列库,可弹性伸缩的工作进程池,工作进程协程支持。
Stars: ✭ 143 (+107.25%)
Mutual labels:  queue, job

Queue manager for NestJS applications

Easy for use and installation into you'r projects.

yarn add nest-queue

Make sure you have installed redis on your host. For local development you can easily install it using docker.

For better working you need to use nest package with 6.*.* ver.

How to

  1. Add new module in your app.module.ts file:

    This module (QueueModule) marked as global.

    import { Module } from '@nestjs/common';
    import { QueueModule } from 'nest-queue';
    
    @Module({
        imports: [
            QueueModule.forRoot({}),
        ]
    })
    export class AppModule {}

    For first parameter forRoot function accept options for current module. Settings very simply and have this structure:

    export interface QueueModuleOptions {
       name?: string,
       connection?: Bull.QueueOptions,
    }

    For connection settings you can take help from Bull documentation. By default connection setting is:

    connection: {
        redis: {
            port: 6379,
        }
    }
    

    It means we will work with localhost:6379 host.

  2. Add queue and handle events

    For add job to queue u need inject a Queue instance into your service or controller. For example:

    import { Controller, Get } from '@nestjs/common'
    import { Queue } from 'bull';
    import { QueueInjection } from 'nest-queue';
    
    @Controller('test')
    class TestController {
       constructor(
           @QueueInjection() private readonly queue: Queue,
       ) {}
    
       @Get('/')
       index() {
           this.queue.add('testEvent', { data: 1, somedata: 2 });
       }
    }

    In this case you can manipulate with job adding. You can add delayed call and etc. Information about it you can take from Bull documentation.

    Anywhere (controllers, services) in your project you can provide event handler for redis calls. @EventConsumer(eventName) method decorator allows you to work with it. For example:

    import { Job, DoneCallback } from 'bull';
    import { EventConsumer } from 'nest-queue';
    
    class TestService {
        @EventConsumer('testEvent')
        eventHandler(job: Job, done: DoneCallback) {
           // job.data has passed data from queue adding
           done(); // required call to stop job
        }
    }

    Context (this) in this function equals to TestService prototype with all resolved dependencies

    Function that will provide as event handler receive two arguments Job and DoneCallback. This function calls as bull-processors and you can take help about from bull Bull documentation.

Future Goals

  • Add tests;
  • Async module adding;
  • Workaround with bull and provide once module for manipulating with jobs;
  • Add console commands lika a queue list and etc for receiving information about all processing jobs and allow to restart failed jobs (like a Laravel artisan queue manager).

Contributors

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].