2.2.5 • Published 3 years ago

type-bull v2.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Description

Bull module for Nest.

Installation

$ npm install --save bull 
$ npm install --save-dev @types/bull
$ npm i --save type-bull

Quick Start

Overview & Tutorial

Quick Guide

Basic Usage

project
│   app.module.ts 
│   
│  
└───test
│   │   test.module.ts
│   │
│   └───test-queue
│       │   test.queue.module.ts
│       │   test.queue.service.ts
│       │   
│       └───queue
│           │
│           │   test.queue.ts
// app.module.ts

@Module({
    imports: [TestModule]
})
export class AppModule {
}
// test.module.ts

@Module({
    imports: [TestQueueModule],
})
export class TestModule {
}
// test.queue.module.ts

@Module({
    imports: [BullModule.forFeature([TestQueue])],
    providers: [TestQueueService, TestQueue]
})
export class TestQueueModule {
}
// test.queue.service.ts

@Injectable()
export class TestQueueService {
    constructor(
        @Inject(TestQueue)
        private readonly testQueue: TypeBull<TestQueue>
    ) {}

    addInQueue(someData) {
      return this.testQueue.constructor.bull.add(someData);
    }
}
// test.queue.ts

@Queue('test_queue', {
    redis: {
        port: 6379,
        host: '127.0.0.1',
    },
})
export class TestQueue extends Bull {
    public readonly logger = new Logger();

    // this way
    @Process('HANDLE_TEST') 
    testProcess(job) {
        this.logger.debug(job)
    }

    // or this way
    @Process({
        name: 'someName',
        filePath: '../somepath.js',
        concurrency: 5
    }) testChildProcess() {}


    @Event('global:progress') 
    testEventGlobal(job, progress) {
        this.logger.debug(job)
        this.logger.debug(progress)
    }

    @Event('progress') 
    testEventProgress(job, progress) {
        this.logger.debug(job)
        this.logger.debug(progress)
    }


}

Stay in touch

License

type-bull is MIT licensed.

bull is MIT licensed.

Nest is MIT licensed.

2.2.1

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.5

3 years ago

2.2.4

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago