Norwegian Parcel Mail

    @architectnow/nest-bull
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    Nest Logo

    A progressive Node.js framework for building efficient and scalable server-side applications.

    NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

    Description

    This is a Bull module for Nest.

    Installation

    $ npm i --save nest-bull bull
    $ npm i --save-dev @types/bull

    Quick Start

    import {Body, Controller, Get, Module, Param, Post} from '@nestjs/common';
    import {DoneCallback, Job, Queue} from 'bull';
    import {BullModule, InjectQueue} from 'nest-bull';
    
    @Controller()
    export class AppController {
    
      constructor(
        @InjectQueue('store') readonly queue: Queue,
      ) {}
    
      @Post()
      async addJob( @Body() value: any ) {
        const job: Job = await this.queue.add(value);
        return job.id;
      }
    
      @Get(':id')
      async getJob( @Param('id') id: string ) {
        return await this.queue.getJob(id);
      }
    }
    
    @Module({
      imports: [
        BullModule.forRoot({
          name: 'store',
          options: {
            redis: {
              port: 6379,
            },
          },
          processors: [
            (job: Job, done: DoneCallback) => { done(null, job.data); },
          ],
        }),
      ],
      controllers: [
        AppController,
      ],
    })
    export class ApplicationModule {}

    People

    Keywords

    none

    Install

    npm i @architectnow/nest-bull

    DownloadsWeekly Downloads

    7

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    35.8 MB

    Total Files

    53

    Last publish

    Collaborators

    • jwelker
    • alwill94
    • nartc
    • cyoung-an
    • an-admin