npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

nest-queue

v1.0.3

Published

Queue manager for NestJS Framework for Redis (via bull package)

Readme

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