Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 2.86 KB

bullmq.worker_2.md

File metadata and controls

52 lines (39 loc) · 2.86 KB

Home > bullmq > Worker_2

Worker_2 class

This class represents a worker that is able to process jobs from the queue. As soon as the class is instantiated it will start processing jobs.

Signature:

export declare class Worker<DataType = any, ResultType = any, NameType extends string = string> extends QueueBase implements WorkerDeclaration 

Extends: QueueBase

Implements: WorkerDeclaration

Constructors

Constructor Modifiers Description
(constructor)(name, processor, opts, Connection) Constructs a new instance of the Worker class

Properties

Property Modifiers Type Description
opts WorkerOptions
paused Promise<void>
processFn Processor<DataType, ResultType, NameType>
repeat Promise<Repeat>
timerManager TimerManager

Methods

Method Modifiers Description
callProcessJob(job, token)
close(force) Closes the worker and related redis connections.This method waits for current jobs to finalize before returning.
createJob(data, jobId)
delay() This function is exposed only for testing purposes.
getNextJob(token, { block }) Returns a promise that resolves to the next job in queue.
isPaused() Checks if worker is paused.
isRunning() Checks if worker is currently running.
moveToActive(token, jobId)
nextJobFromJobData(jobData, jobId)
pause(doNotWaitActive) Pauses the processing of this queue only for this worker.
processJob(job, token)
resume() Resumes processing of this worker (if paused).
run()
waitUntilReady() Waits until the worker is ready to start processing jobs. In general only useful when writing tests.