Skip to main content

Class: JobWatcher

Defined in: watchers/job.watcher.ts:63

Implements​

  • OnModuleInit
  • OnModuleDestroy

Constructors​

Constructor​

new JobWatcher(collector, nestlensConfig): JobWatcher

Defined in: watchers/job.watcher.ts:85

Parameters​

collector​

CollectorService

nestlensConfig​

NestLensConfig

Returns​

JobWatcher

Methods​

closeQueueEvents()​

closeQueueEvents(): Promise<void>

Defined in: watchers/job.watcher.ts:203

Close all QueueEvents instances created by setupBullMQQueue. Called automatically when the module closes; safe to call yourself.

Returns​

Promise<void>


onModuleDestroy()​

onModuleDestroy(): Promise<void>

Defined in: watchers/job.watcher.ts:190

Takes every listener off and closes what setupBullMQQueue opened.

closeQueueEvents used to be the caller's job — the documentation asked for it to be called from their own onModuleDestroy, which is a step that is easy not to know about and easy to forget. It still exists and is still safe to call; it simply does not have to be.

Returns​

Promise<void>

Implementation of​

OnModuleDestroy.onModuleDestroy


onModuleInit()​

onModuleInit(): void

Defined in: watchers/job.watcher.ts:94

Returns​

void

Implementation of​

OnModuleInit.onModuleInit


setupBullMQQueue()​

setupBullMQQueue(queue, queueName?): Promise<void>

Defined in: watchers/job.watcher.ts:136

Setup interceptors on a BullMQ queue (simplified API). Automatically creates QueueEvents using the queue's Redis connection.

Parameters​

queue​

unknown

The BullMQ Queue instance

queueName?​

string

Optional queue name (defaults to queue.name)

Returns​

Promise<void>


setupQueue()​

setupQueue(queue, queueName?): void

Defined in: watchers/job.watcher.ts:108

Setup interceptors on a Bull/BullMQ queue. Call this manually for each queue you want to track.

Parameters​

queue​

unknown

queueName?​

string

Returns​

void


setupQueueWithEvents()​

setupQueueWithEvents(queue, queueEvents, queueName?): void

Defined in: watchers/job.watcher.ts:222

Setup interceptors on a BullMQ queue using QueueEvents. Use this if you need to manage QueueEvents lifecycle yourself.

Parameters​

queue​

unknown

The BullMQ Queue instance (for fetching job data)

queueEvents​

unknown

The BullMQ QueueEvents instance (for listening to events)

queueName?​

string

Optional queue name (defaults to queue.name)

Returns​

void