Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Releases: anchan828/nest-bull

v3.1.0

26 Oct 00:46
Compare
Choose a tag to compare

Support bullmq@3

v3.0.0

21 Sep 13:57
Compare
Choose a tag to compare

@anchan828/nest-bullmq and @anchan828/nest-bullmq-terminus

Support bullmq@2

v1.1.0

12 Feb 04:18
Compare
Choose a tag to compare

@anchan828/nest-bullmq

BullQueueEventProcess deprecated

Use BullQueueListener, BullWorkerListener and BullQueueEventsListener instead.

Add Worker/Queue/QueueEvents listener decorators

Add dedicated listener decorators for more clarity.

Worker listeners

All event names can be found here.

import { BullWorker, BullWorkerProcess, BullWorkerListener, BullWorkerListenerArgs } from "@anchan828/nest-bullmq";
import { APP_QUEUE } from "./app.constants";

@BullWorker({ queueName: APP_QUEUE })
export class ExampleBullWorker {
  @BullWorkerProcess()
  public async process(job: Job): Promise<{ status: string }> {
    return { status: "ok" };
  }

  @BullWorkerListener("completed")
  public async completed(job: BullWorkerListenerArgs["completed"]): Promise<void> {
    calledEvents("completed");
    console.debug(`[${job.id}] completed`);
  }
}

Queue listeners

All event names can be found here.

import { BullQueue, BullQueueListener, BullQueueListenerArgs } from "@anchan828/nest-bullmq";
import { APP_QUEUE } from "./app.constants";

@BullQueue({ queueName: APP_QUEUE })
export class ExampleBullQueue {
  @BullQueueListener("waiting")
  public async waiting(job: BullQueueListenerArgs["waiting"]): Promise<void> {
    calledEvents("waiting");
    console.debug(`[${job.id}] waiting`);
  }
}

QueueEvents listeners

All event names can be found here.

import { BullQueueEvents, BullQueueEventsListener, BullQueueEventsListenerArgs } from "@anchan828/nest-bullmq";
import { APP_QUEUE } from "./app.constants";

@BullQueueEvents({ queueName: APP_QUEUE })
export class ExampleBullQueueEvents {
  @BullQueueEventsListener("added")
  public async added(args: BullQueueEventsListenerArgs["added"]): Promise<void> {
    console.debug(`[${args.jobId}] added`);
  }

  @BullQueueEventsListener("active")
  public async active(args: BullQueueEventsListenerArgs["active"]): Promise<void> {
    console.debug(`[${args.jobId}] active`);
  }

  @BullQueueEventsListener("completed")
  public async completed(args: BullQueueEventsListenerArgs["completed"]): Promise<void> {
    console.debug(`[${args.jobId}] completed`);
  }

  @BullQueueEventsListener("waiting")
  public async waiting(args: BullQueueEventsListenerArgs["waiting"]): Promise<void> {
    console.debug(`[${args.jobId}] waiting`);
  }
}

v1.0.0

08 Jul 13:57
Compare
Choose a tag to compare

Updated to nestjs v8

v0.5.0

10 Dec 02:30
Compare
Choose a tag to compare
  • terminus packages
    • drop @godaddy/terminus
    • adopted the newest way.

Please create controller for checking helth.

  @Controller("/health")
  class BullHealthController {
    constructor(private health: HealthCheckService, private bull: BullHealthIndicator) {}

    @Get()
    @HealthCheck()
    check() {
      return this.health.check([() => this.bull.isHealthy()]);
    }
  }