@nest-boot/bullmq
Enumerations
ChildCommand
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/child-command.d.ts:1
Enumeration Members
GetChildrenValuesResponse
GetChildrenValuesResponse: 3;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/child-command.d.ts:5
GetIgnoredChildrenFailuresResponse
GetIgnoredChildrenFailuresResponse: 4;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/child-command.d.ts:6
Init
Init: 0;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/child-command.d.ts:2
MoveToWaitingChildrenResponse
MoveToWaitingChildrenResponse: 5;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/child-command.d.ts:7
Start
Start: 1;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/child-command.d.ts:3
Stop
Stop: 2;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/child-command.d.ts:4
ClientType
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:5
Enumeration Members
blocking
blocking: "blocking";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:6
normal
normal: "normal";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:7
ErrorCode
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:1
Enumeration Members
JobBelongsToJobScheduler
JobBelongsToJobScheduler: -8;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:9
JobHasFailedChildren
JobHasFailedChildren: -9;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:10
JobLockMismatch
JobLockMismatch: -6;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:7
JobLockNotExist
JobLockNotExist: -2;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:3
JobNotExist
JobNotExist: -1;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:2
JobNotInState
JobNotInState: -3;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:4
JobPendingChildren
JobPendingChildren: -4;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:5
ParentJobCannotBeReplaced
ParentJobCannotBeReplaced: -7;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:8
ParentJobNotExist
ParentJobNotExist: -5;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:6
SchedulerJobIdCollision
SchedulerJobIdCollision: -10;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:11
SchedulerJobSlotsBusy
SchedulerJobSlotsBusy: -11;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/error-code.d.ts:12
MetricsTime
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:1
Enumeration Members
FIFTEEN_MINUTES
FIFTEEN_MINUTES: 15;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:4
FIVE_MINUTES
FIVE_MINUTES: 5;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:3
ONE_HOUR
ONE_HOUR: 60;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:6
ONE_MINUTE
ONE_MINUTE: 1;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:2
ONE_MONTH
ONE_MONTH: 80640;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:9
ONE_WEEK
ONE_WEEK: 10080;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:7
THIRTY_MINUTES
THIRTY_MINUTES: 30;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:5
TWO_WEEKS
TWO_WEEKS: 20160;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts:8
ParentCommand
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:1
Enumeration Members
Completed
Completed: 0;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:2
Error
Error: 1;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:3
Failed
Failed: 2;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:4
GetChildrenValues
GetChildrenValues: 10;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:12
GetIgnoredChildrenFailures
GetIgnoredChildrenFailures: 11;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:13
InitCompleted
InitCompleted: 4;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:6
InitFailed
InitFailed: 3;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:5
Log
Log: 5;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:7
MoveToDelayed
MoveToDelayed: 6;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:8
MoveToWait
MoveToWait: 7;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:9
MoveToWaitingChildren
MoveToWaitingChildren: 12;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:14
Progress
Progress: 8;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:10
Update
Update: 9;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/parent-command.d.ts:11
SpanKind
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:37
Enumeration Members
CLIENT
CLIENT: 2;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:40
CONSUMER
CONSUMER: 4;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:42
INTERNAL
INTERNAL: 0;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:38
PRODUCER
PRODUCER: 3;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:41
SERVER
SERVER: 1;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:39
TelemetryAttributes
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:1
Enumeration Members
BulkCount
BulkCount: "bullmq.job.bulk.count";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:4
BulkNames
BulkNames: "bullmq.job.bulk.names";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:5
DeduplicationKey
DeduplicationKey: "bullmq.job.deduplication.key";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:11
FlowName
FlowName: "bullmq.flow.name";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:34
JobAttemptsMade
JobAttemptsMade: "bullmq.job.attempts.made";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:10
JobFailedReason
JobFailedReason: "bullmq.job.failed.reason";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:33
JobFinishedTimestamp
JobFinishedTimestamp: "bullmq.job.finished.timestamp";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:30
JobId
JobId: "bullmq.job.id";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:7
JobIds
JobIds: "bullmq.job.ids";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:9
JobKey
JobKey: "bullmq.job.key";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:8
JobName
JobName: "bullmq.job.name";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:6
JobOptions
JobOptions: "bullmq.job.options";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:12
JobProcessedTimestamp
JobProcessedTimestamp: "bullmq.job.processed.timestamp";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:31
JobProgress
JobProgress: "bullmq.job.progress";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:13
JobResult
JobResult: "bullmq.job.result";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:32
JobSchedulerId
JobSchedulerId: "bullmq.job.scheduler.id";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:35
JobType
JobType: "bullmq.job.type";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:18
QueueCleanLimit
QueueCleanLimit: "bullmq.queue.clean.limit";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:16
QueueDrainDelay
QueueDrainDelay: "bullmq.queue.drain.delay";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:14
QueueEventMaxLength
QueueEventMaxLength: "bullmq.queue.event.max.length";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:20
QueueGrace
QueueGrace: "bullmq.queue.grace";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:15
QueueName
QueueName: "bullmq.queue.name";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:2
QueueOperation
QueueOperation: "bullmq.queue.operation";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:3
QueueOptions
QueueOptions: "bullmq.queue.options";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:19
QueueRateLimit
QueueRateLimit: "bullmq.queue.rate.limit";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:17
WorkerDoNotWaitActive
WorkerDoNotWaitActive: "bullmq.worker.do.not.wait.active";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:25
WorkerFailedJobs
WorkerFailedJobs: "bullmq.worker.failed.jobs";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:28
WorkerForceClose
WorkerForceClose: "bullmq.worker.force.close";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:26
WorkerId
WorkerId: "bullmq.worker.id";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:23
WorkerJobsToExtendLocks
WorkerJobsToExtendLocks: "bullmq.worker.jobs.to.extend.locks";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:29
WorkerName
WorkerName: "bullmq.worker.name";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:22
WorkerOptions
WorkerOptions: "bullmq.worker.options";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:21
WorkerRateLimit
WorkerRateLimit: "bullmq.worker.rate.limit";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:24
WorkerStalledJobs
WorkerStalledJobs: "bullmq.worker.stalled.jobs";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts:27
Classes
AsyncFifoQueue
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:12
AsyncFifoQueue
A minimal FIFO queue for asynchronous operations. Allows adding asynchronous operations and consume them in the order they are resolved.
Type Parameters
| Type Parameter |
|---|
T |
Constructors
Constructor
new AsyncFifoQueue<T>(ignoreErrors?): AsyncFifoQueue<T>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:31
Parameters
| Parameter | Type |
|---|---|
ignoreErrors? | boolean |
Returns
Methods
add()
add(promise): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:32
Parameters
| Parameter | Type |
|---|---|
promise | Promise<T> |
Returns
void
fetch()
fetch(): Promise<void | T>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:41
Returns
Promise<void | T>
numPending()
numPending(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:35
Returns
number
numQueued()
numQueued(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:36
Returns
number
numTotal()
numTotal(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:34
Returns
number
waitAll()
waitAll(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts:33
Returns
Promise<void>
Backoffs
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/backoffs.d.ts:7
Constructors
Constructor
new Backoffs(): Backoffs;
Returns
Properties
builtinStrategies
static builtinStrategies: BuiltInStrategies;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/backoffs.d.ts:8
Methods
calculate()
static calculate(
backoff,
attemptsMade,
err,
job,
customStrategy?): number | Promise<number> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/backoffs.d.ts:10
Parameters
| Parameter | Type |
|---|---|
backoff | BackoffOptions |
attemptsMade | number |
err | Error |
job | MinimalJob |
customStrategy? | BackoffStrategy |
Returns
number | Promise<number> | undefined
normalize()
static normalize(backoff): BackoffOptions | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/backoffs.d.ts:9
Parameters
| Parameter | Type |
|---|---|
backoff | number | BackoffOptions |
Returns
BackoffOptions | undefined
BullModule
Defined in: packages/bullmq/src/bullmq.module.ts:34
Extends
ConfigurableModuleClass
Indexable
[key: string]: any
Constructors
Constructor
new BullModule(): BullModule;
Defined in: node_modules/.pnpm/@nestjs+common@11.1.9/node_modules/@nestjs/common/module-utils/interfaces/configurable-module-cls.interface.d.ts:12
Returns
Inherited from
ConfigurableModuleClass.constructor
Properties
forRoot()
static forRoot: (options) => DynamicModule;
Parameters
| Parameter | Type |
|---|---|
options | BullModuleOptions & Partial<{ }> |
Returns
DynamicModule
Inherited from
ConfigurableModuleClass.forRoot
forRootAsync()
static forRootAsync: (options) => DynamicModule;
Parameters
| Parameter | Type |
|---|---|
options | ConfigurableModuleAsyncOptions<BullModuleOptions, "create"> & Partial<{ }> |
Returns
DynamicModule
Inherited from
ConfigurableModuleClass.forRootAsync
Methods
registerQueue()
static registerQueue(...args): DynamicModule;
Defined in: packages/bullmq/src/bullmq.module.ts:35
Parameters
| Parameter | Type |
|---|---|
...args | RegisterQueueOptions[] |
Returns
DynamicModule
registerQueueAsync()
static registerQueueAsync(...args): DynamicModule;
Defined in: packages/bullmq/src/bullmq.module.ts:41
Parameters
| Parameter | Type |
|---|---|
...args | RegisterQueueAsyncOptions[] |
Returns
DynamicModule
BullRegistrar
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/bull.registrar.d.ts:4
Implements
OnModuleInit
Constructors
Constructor
new BullRegistrar(moduleRef, bullExplorer): BullRegistrar;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/bull.registrar.d.ts:7
Parameters
| Parameter | Type |
|---|---|
moduleRef | ModuleRef |
bullExplorer | BullExplorer |
Returns
Methods
onModuleInit()
onModuleInit(): void;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/bull.registrar.d.ts:8
Returns
void
Implementation of
OnModuleInit.onModuleInit
register()
register(): void;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/bull.registrar.d.ts:9
Returns
void
Child
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:12
Child class
This class is used to create a child process or worker thread, and allows using isolated processes or threads for processing jobs.
Extends
EventEmitter
Constructors
Constructor
new Child(
mainFile,
processFile,
opts?): Child;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:21
Parameters
| Parameter | Type |
|---|---|
mainFile | string |
processFile | string |
opts? | SandboxedOptions |
Returns
Overrides
EventEmitter.constructor
Properties
childProcess
childProcess: ChildProcess;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:16
processFile
processFile: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:14
worker
worker: Worker;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:17
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejections
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
EventEmitter.defaultMaxListeners
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
EventEmitter.errorMonitor
Accessors
exitCode
Get Signature
get exitCode(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:23
Returns
number
killed
Get Signature
get killed(): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:25
Returns
boolean
pid
Get Signature
get pid(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:22
Returns
number
signalCode
Get Signature
get signalCode(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:24
Returns
number
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
EventEmitter.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.addListener
emit()
emit<K>(eventName, ...args): boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:904
Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments
to each.
Returns true if the event had listeners, false otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
...args | AnyRest |
Returns
boolean
Since
v0.1.26
Inherited from
EventEmitter.emit
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
EventEmitter.eventNames
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
EventEmitter.getMaxListeners
hasProcessExited()
hasProcessExited(): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:31
Returns
boolean
init()
init(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:26
Returns
Promise<void>
kill()
kill(signal?, timeoutMs?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:29
Parameters
| Parameter | Type |
|---|---|
signal? | "SIGTERM" | "SIGKILL" |
timeoutMs? | number |
Returns
Promise<void>
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
EventEmitter.listenerCount
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
EventEmitter.listeners
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
EventEmitter.off
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Inherited from
EventEmitter.on
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
EventEmitter.once
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependListener
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependOnceListener
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
EventEmitter.rawListeners
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeAllListeners
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeListener
send()
send(msg): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child.d.ts:27
Parameters
| Parameter | Type |
|---|---|
msg | any |
Returns
Promise<void>
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
EventEmitter.setMaxListeners
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
EventEmitter.addAbortListener
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
EventEmitter.getEventListeners
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
EventEmitter.listenerCount
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
EventEmitter.setMaxListeners
ChildPool
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:6
Constructors
Constructor
new ChildPool(__namedParameters): ChildPool;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:14
Parameters
| Parameter | Type |
|---|---|
__namedParameters | ChildPoolOpts |
Returns
Properties
free
free: {
[key: string]: Child[];
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:10
Index Signature
[key: string]: Child[]
retained
retained: {
[key: number]: Child;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:7
Index Signature
[key: number]: Child
Methods
clean()
clean(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:19
Returns
Promise<void>
getAllFree()
getAllFree(): Child[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:21
Returns
Child[]
getFree()
getFree(id): Child[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:20
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Child[]
kill()
kill(child, signal?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:18
Parameters
| Parameter | Type |
|---|---|
child | Child |
signal? | "SIGTERM" | "SIGKILL" |
Returns
Promise<void>
release()
release(child): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:16
Parameters
| Parameter | Type |
|---|---|
child | Child |
Returns
void
remove()
remove(child): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:17
Parameters
| Parameter | Type |
|---|---|
child | Child |
Returns
void
retain()
retain(processFile): Promise<Child>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-pool.d.ts:15
Parameters
| Parameter | Type |
|---|---|
processFile | string |
Returns
Promise<Child>
ChildProcessor
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:16
ChildProcessor
This class acts as the interface between a child process and it parent process so that jobs can be processed in different processes.
Constructors
Constructor
new ChildProcessor(send, receiver): ChildProcessor;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:22
Parameters
| Parameter | Type |
|---|---|
send | (msg) => Promise<void> |
receiver | Receiver |
Returns
Properties
currentJobPromise
currentJobPromise: Promise<unknown> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:21
processor
processor: any;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:20
status?
optional status: ChildStatus;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:19
Methods
init()
init(processorFile): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:23
Parameters
| Parameter | Type |
|---|---|
processorFile | string |
Returns
Promise<void>
start()
start(jobJson, token?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:24
Parameters
| Parameter | Type |
|---|---|
jobJson | JobJsonSandbox |
token? | string |
Returns
Promise<void>
stop()
stop(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:25
Returns
Promise<void>
waitForCurrentJobAndExit()
waitForCurrentJobAndExit(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:26
Returns
Promise<void>
wrapJob()
protected wrapJob(job, send): SandboxedJob;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/child-processor.d.ts:36
Enhance the given job argument with some functions that can be called from the sandboxed job processor.
Note, the job argument is a JSON deserialized message
from the main node process to this forked child process,
the functions on the original job object are not in tact.
The wrapped job adds back some of those original functions.
Parameters
| Parameter | Type |
|---|---|
job | JobJsonSandbox |
send | (msg) => Promise<void> |
Returns
DelayedError
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/delayed-error.d.ts:9
DelayedError
Error to be thrown when job is moved to delayed state from job in active state.
Extends
Error
Constructors
Constructor
new DelayedError(message?): DelayedError;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/delayed-error.d.ts:10
Parameters
| Parameter | Type |
|---|---|
message? | string |
Returns
Overrides
Error.constructor
Properties
message
message: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.message
name
name: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.name
stack?
optional stack: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
FlowProducer
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:70
This class allows to add jobs with dependencies between them in such a way that it is possible to build complex flows. Note: A flow is a tree-like structure of jobs that depend on each other. Whenever the children of a given parent are completed, the parent will be processed, being able to access the children's result data. All Jobs can be in different queues, either children or parents,
Extends
EventEmitter
Constructors
Constructor
new FlowProducer(opts?, Connection?): FlowProducer;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:81
Parameters
| Parameter | Type |
|---|---|
opts? | QueueBaseOptions |
Connection? | typeof RedisConnection |
Returns
Overrides
EventEmitter.constructor
Properties
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:74
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:76
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:73
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:71
queueKeys
queueKeys: QueueKeys;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:75
telemetry
protected telemetry: {
contextManager: ContextManager<any> | undefined;
tracer: Tracer<any> | undefined;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:77
contextManager
contextManager: ContextManager<any> | undefined;
tracer
tracer: Tracer<any> | undefined;
toKey()
toKey: (name, type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:72
Parameters
| Parameter | Type |
|---|---|
name | string |
type | string |
Returns
string
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejections
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
EventEmitter.defaultMaxListeners
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
EventEmitter.errorMonitor
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:89
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:93
Helper to easily extend Job class calls.
Returns
typeof Job
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
EventEmitter.[captureRejectionSymbol]
add()
add(flow, opts?): Promise<JobNode>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:105
Adds a flow.
This call would be atomic, either it fails and no jobs will be added to the queues, or it succeeds and all jobs will be added.
Parameters
| Parameter | Type | Description |
|---|---|---|
flow | FlowJob | an object with a tree-like structure where children jobs will be processed before their parents. |
opts? | FlowOpts | options that will be applied to the flow object. |
Returns
Promise<JobNode>
addBulk()
addBulk(flows): Promise<JobNode[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:126
Adds multiple flows.
A flow is a tree-like structure of jobs that depend on each other. Whenever the children of a given parent are completed, the parent will be processed, being able to access the children's result data.
All Jobs can be in different queues, either children or parents, however this call would be atomic, either it fails and no jobs will be added to the queues, or it succeeds and all jobs will be added.
Parameters
| Parameter | Type | Description |
|---|---|---|
flows | FlowJob[] | an array of objects with a tree-like structure where children jobs will be processed before their parents. |
Returns
Promise<JobNode[]>
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.addListener
addNode()
protected addNode(multi): Promise<JobNode>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:138
Add a node (job) of a flow to the queue. This method will recursively add all its children as well. Note that a given job can potentially be a parent and a child job at the same time depending on where it is located in the tree hierarchy.
Parameters
| Parameter | Type | Description |
|---|---|---|
multi | AddNodeOpts | ioredis ChainableCommander |
Returns
Promise<JobNode>
addNodes()
protected addNodes(multi, nodes): Promise<JobNode[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:149
Adds nodes (jobs) of multiple flows to the queue. This method will recursively add all its children as well. Note that a given job can potentially be a parent and a child job at the same time depending on where it is located in the tree hierarchy.
Parameters
| Parameter | Type | Description |
|---|---|---|
multi | ChainableCommander | ioredis ChainableCommander |
nodes | FlowJob[] | the nodes representing jobs to be added to some queue |
Returns
Promise<JobNode[]>
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:166
Closes the connection and returns a promise that resolves when the connection is closed.
Returns
Promise<void>
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:171
Force disconnects a connection.
Returns
Promise<void>
emit()
emit<U>(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:82
Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments
to each.
Returns true if the event had listeners, false otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
Type Parameters
| Type Parameter |
|---|
U extends keyof FlowProducerListener |
Parameters
| Parameter | Type |
|---|---|
event | U |
...args | Parameters<FlowProducerListener[U]> |
Returns
boolean
Since
v0.1.26
Overrides
EventEmitter.emit
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
EventEmitter.eventNames
getFlow()
getFlow(opts): Promise<JobNode>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:111
Get a flow.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | NodeOpts | an object with options for getting a JobNode. |
Returns
Promise<JobNode>
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
EventEmitter.listenerCount
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
EventEmitter.listeners
off()
off<U>(eventName, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:83
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
U extends keyof FlowProducerListener |
Parameters
| Parameter | Type |
|---|---|
eventName | U |
listener | FlowProducerListener[U] |
Returns
this
Since
v10.0.0
Overrides
EventEmitter.off
on()
on<U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:84
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
U extends keyof FlowProducerListener |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | - |
listener | FlowProducerListener[U] | The callback function |
Returns
this
Since
v0.1.101
Overrides
EventEmitter.on
once()
once<U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:85
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
U extends keyof FlowProducerListener |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | - |
listener | FlowProducerListener[U] | The callback function |
Returns
this
Since
v0.3.0
Overrides
EventEmitter.once
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependListener
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependOnceListener
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
EventEmitter.rawListeners
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeAllListeners
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeListener
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
EventEmitter.setMaxListeners
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:94
Returns
Promise<RedisClient>
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
EventEmitter.addAbortListener
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
EventEmitter.getEventListeners
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
EventEmitter.listenerCount
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
EventEmitter.setMaxListeners
Job
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:15
Job
This class represents a Job in the queue. Normally job are implicitly created when you add a job to the queue with methods such as Queue.addJob( ... )
A Job instance is also passed to the Worker's process function.
Type Parameters
| Type Parameter |
|---|
DataType |
ReturnType |
NameType extends string |
Implements
MinimalJob<DataType,ReturnType,NameType>
Constructors
Constructor
new Job<DataType, ReturnType, NameType>(
queue,
name,
data,
opts?,
id?): Job<DataType, ReturnType, NameType>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:138
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | MinimalQueue | - |
name | NameType | The name of the Job |
data | DataType | The payload for this job. |
opts? | JobsOptions | The options object for this job. |
id? | string | - |
Returns
Job<DataType, ReturnType, NameType>
Properties
attemptsMade
attemptsMade: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:75
Number of attempts after the job has failed.
Default Value
0
Implementation of
attemptsStarted
attemptsStarted: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:70
Number of attempts when job is moved to active.
Default Value
0
data
data: DataType;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:24
The payload for this job.
Implementation of
debounceId?
optional debounceId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:110
Debounce identifier.
Deprecated
use deduplicationId
deduplicationId?
optional deduplicationId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:114
Deduplication identifier.
deferredFailure
deferredFailure: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:89
Deferred failure. Stores a failed message and marks this job to be failed directly as soon as the job is picked up by a worker, and using this string as the failed reason.
delay
delay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:54
An amount of milliseconds to wait until this job can be processed.
Default Value
0
Implementation of
discarded
protected discarded: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:136
Deprecated
use UnrecoverableError
failedReason
failedReason: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:84
Reason for failing.
Implementation of
finishedOn?
optional finishedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:93
Timestamp for when the job finished (completed or failed).
Implementation of
id?
optional id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:29
Implementation of
name
name: NameType;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:20
The name of the Job
Implementation of
nextRepeatableJobId?
optional nextRepeatableJobId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:123
Produced next repetable job Id.
opts
opts: JobsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:28
The options object for this job.
Implementation of
parent?
optional parent: ParentKeys;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:105
Object that contains parentId (id) and parent queueKey.
Implementation of
parentKey?
optional parentKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:101
Fully qualified key (including the queue prefix) pointing to the parent of this job.
Implementation of
priority
priority: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:61
Ranges from 0 (highest priority) to 2 097 152 (lowest priority). Note that using priorities has a slight impact on performance, so do not use it if not required.
Default Value
0
processedBy?
optional processedBy: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:131
The worker name that is processing or processed this job.
processedOn?
optional processedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:97
Timestamp for when the job was processed.
Implementation of
progress
progress: JobProgress;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:39
The progress a job has performed so far.
Default Value
0
Implementation of
queue
protected queue: MinimalQueue;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:16
queueQualifiedName
readonly queueQualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:34
It includes the prefix, the namespace separator :, and queue name.
See
https://www.gnu.org/software/gawk/manual/html_node/Qualified-Names.html
Implementation of
repeatJobKey?
optional repeatJobKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:118
Base repeat job key.
Implementation of
returnvalue
returnvalue: ReturnType;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:44
The value returned by the processor when processing this job.
Default Value
null
Implementation of
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:137
stacktrace
stacktrace: string[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:49
Stacktrace for the error (for failed jobs).
Default Value
null
Implementation of
stalledCounter
stalledCounter: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:80
Number of times where job has stalled.
Default Value
0
timestamp
timestamp: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:65
Timestamp when the job was created (unless overridden with job options).
Implementation of
token?
optional token: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:127
The token used for locking this job.
toKey()
protected toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:132
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Accessors
prefix
Get Signature
get prefix(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:331
Returns
string
the prefix that is used.
Implementation of
queueName
Get Signature
get queueName(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:327
Returns
string
the queue name this job belongs to.
Implementation of
Methods
addJob()
addJob(client, parentOpts?): Promise<string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:481
Adds the job to Redis.
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
parentOpts? | ParentKeyOpts |
Returns
Promise<string>
asJSON()
asJSON(): JobJson;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:208
Prepares a job to be serialized for storage in Redis.
Returns
Implementation of
asJSONSandbox()
asJSONSandbox(): JobJsonSandbox;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:214
Prepares a job to be passed to Sandbox.
Returns
Implementation of
changeDelay()
changeDelay(delay): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:353
Change delay of a delayed job.
Reschedules a delayed job by setting a new delay from the current time. For example, calling changeDelay(5000) will reschedule the job to execute 5000 milliseconds (5 seconds) from now, regardless of the original delay.
Parameters
| Parameter | Type | Description |
|---|---|---|
delay | number | milliseconds from now when the job should be processed. |
Returns
Promise<void>
void
Throws
JobNotExist This exception is thrown if jobId is missing.
Throws
JobNotInState This exception is thrown if job is not in delayed state.
changePriority()
changePriority(opts): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:360
Change job priority.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | { lifo?: boolean; priority?: number; } | options containing priority and lifo values. |
opts.lifo? | boolean | - |
opts.priority? | number | - |
Returns
Promise<void>
void
clearLogs()
clearLogs(keepLogs?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:245
Clears job's logs
Parameters
| Parameter | Type | Description |
|---|---|---|
keepLogs? | number | the amount of log entries to preserve |
Returns
Promise<void>
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:182
Returns
void
discard()
discard(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:471
Marks a job to not be retried if it fails (even if attempts has been configured)
Returns
void
Deprecated
use UnrecoverableError
extendLock()
extendLock(token, duration): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:271
Extend the lock for this job.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | unique token for the lock |
duration | number | lock duration in milliseconds |
Returns
Promise<number>
getChildrenValues()
getChildrenValues<CT>(): Promise<{
[jobKey: string]: CT;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:369
Get this jobs children result values if any.
Type Parameters
| Type Parameter |
|---|
CT |
Returns
Promise<{
[jobKey: string]: CT;
}>
Object mapping children job keys with their values.
getDependencies()
getDependencies(opts?): Promise<{
failed?: string[];
ignored?: Record<string, any>;
nextFailedCursor?: number;
nextIgnoredCursor?: number;
nextProcessedCursor?: number;
nextUnprocessedCursor?: number;
processed?: Record<string, any>;
unprocessed?: string[];
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:403
Get children job keys if this job is a parent and has children.
Parameters
| Parameter | Type |
|---|---|
opts? | DependenciesOpts |
Returns
Promise<{
failed?: string[];
ignored?: Record<string, any>;
nextFailedCursor?: number;
nextIgnoredCursor?: number;
nextProcessedCursor?: number;
nextUnprocessedCursor?: number;
processed?: Record<string, any>;
unprocessed?: string[];
}>
dependencies separated by processed, unprocessed, ignored and failed.
Remarks
Count options before Redis v7.2 works as expected with any quantity of entries on processed/unprocessed dependencies, since v7.2 you must consider that count won't have any effect until processed/unprocessed dependencies have a length greater than 127
See
- https://redis.io/docs/management/optimization/memory-optimization/#redis--72
- https://docs.bullmq.io/guide/flows#getters
getDependenciesCount()
getDependenciesCount(opts?): Promise<{
failed?: number;
ignored?: number;
processed?: number;
unprocessed?: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:418
Get children job counts if this job is a parent and has children.
Parameters
| Parameter | Type |
|---|---|
opts? | { failed?: boolean; ignored?: boolean; processed?: boolean; unprocessed?: boolean; } |
opts.failed? | boolean |
opts.ignored? | boolean |
opts.processed? | boolean |
opts.unprocessed? | boolean |
Returns
Promise<{
failed?: number;
ignored?: number;
processed?: number;
unprocessed?: number;
}>
dependencies count separated by processed, unprocessed, ignored and failed.
getFailedChildrenValues()
getFailedChildrenValues(): Promise<{
[jobKey: string]: string;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:389
Get job's children failure values that were ignored if any.
Returns
Promise<{
[jobKey: string]: string;
}>
Object mapping children job keys with their failure values.
Deprecated
This method is deprecated and will be removed in v6. Use getIgnoredChildrenFailures instead.
getIgnoredChildrenFailures()
getIgnoredChildrenFailures(): Promise<{
[jobKey: string]: string;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:379
Retrieves the failures of child jobs that were explicitly ignored while using ignoreDependencyOnFailure option. This method is useful for inspecting which child jobs were intentionally ignored when an error occured.
Returns
Promise<{
[jobKey: string]: string;
}>
Object mapping children job keys with their failure values.
See
https://docs.bullmq.io/guide/flows/ignore-dependency
getState()
getState(): Promise<JobState | "unknown">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:338
Get current state.
Returns
Promise<JobState | "unknown">
Returns one of these values: 'completed', 'failed', 'delayed', 'active', 'waiting', 'waiting-children', 'unknown'.
isActive()
isActive(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:319
Returns
Promise<boolean>
true of the job is active.
isCompleted()
isCompleted(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:303
Returns
Promise<boolean>
true if the job has completed.
isDelayed()
isDelayed(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:311
Returns
Promise<boolean>
true if the job is delayed.
isFailed()
isFailed(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:307
Returns
Promise<boolean>
true if the job has failed.
isWaiting()
isWaiting(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:323
Returns
Promise<boolean>
true if the job is waiting.
isWaitingChildren()
isWaitingChildren(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:315
Returns
Promise<boolean>
true if the job is waiting for children.
log()
log(logRow): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:233
Logs one row of log data.
Parameters
| Parameter | Type | Description |
|---|---|---|
logRow | string | string with log data to be logged. |
Returns
Promise<number>
The total number of log entries for this job so far.
Implementation of
moveToCompleted()
moveToCompleted(
returnValue,
token,
fetchNext?): Promise<void | any[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:281
Moves a job to the completed queue. Returned job to be used with Queue.prototype.nextJobFromJobData.
Parameters
| Parameter | Type | Description |
|---|---|---|
returnValue | ReturnType | The jobs success message. |
token | string | Worker token used to acquire completed job. |
fetchNext? | boolean | True when wanting to fetch the next job. |
Returns
Promise<void | any[]>
Returns the jobData of the next job in the waiting queue or void.
moveToDelayed()
moveToDelayed(timestamp, token?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:444
Moves the job to the delay set.
Parameters
| Parameter | Type | Description |
|---|---|---|
timestamp | number | timestamp when the job should be moved back to "wait" |
token? | string | token to check job is locked by current worker |
Returns
Promise<void>
moveToFailed()
moveToFailed<E>(
err,
token,
fetchNext?): Promise<void | any[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:298
Moves a job to the failed queue.
Type Parameters
| Type Parameter |
|---|
E extends Error |
Parameters
| Parameter | Type | Description |
|---|---|---|
err | E | the jobs error message. |
token | string | token to check job is locked by current worker |
fetchNext? | boolean | true when wanting to fetch the next job |
Returns
Promise<void | any[]>
Returns the jobData of the next job in the waiting queue or void.
moveToWait()
moveToWait(token?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:288
Moves a job to the wait or prioritized state.
Parameters
| Parameter | Type | Description |
|---|---|---|
token? | string | Worker token used to acquire completed job. |
Returns
Promise<number>
Returns pttl.
moveToWaitingChildren()
moveToWaitingChildren(token, opts?): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:452
Moves the job to the waiting-children set.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | Token to check job is locked by current worker |
opts? | MoveToWaitingChildrenOpts | The options bag for moving a job to waiting-children. |
Returns
Promise<boolean>
true if the job was moved
promote()
promote(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:456
Promotes a delayed job so that it starts to be processed as soon as possible.
Returns
Promise<void>
remove()
remove(opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:253
Completely remove the job from the queue. Note, this call will throw an exception if the job is being processed when the call is performed.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | { removeChildren?: boolean; } | Options to remove a job |
opts.removeChildren? | boolean | - |
Returns
Promise<void>
removeChildDependency()
removeChildDependency(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:239
Removes child dependency from parent when child is not yet finished
Returns
Promise<boolean>
True if the relationship existed and if it was removed.
removeDeduplicationKey()
removeDeduplicationKey(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:486
Removes a deduplication key if job is still the cause of deduplication.
Returns
Promise<boolean>
true if the deduplication key was removed.
removeUnprocessedChildren()
removeUnprocessedChildren(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:264
Remove all children from this job that are not yet processed, in other words that are in any other state than completed, failed or active.
Returns
Promise<void>
Remarks
- Jobs with locks (most likely active) are ignored.
- This method can be slow if the number of children is large (\> 1000).
retry()
retry(state?, opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:466
Attempts to retry the job. Only a job that has failed or completed can be retried.
Parameters
| Parameter | Type | Description |
|---|---|---|
state? | FinishedStatus | completed / failed |
opts? | RetryOptions | options to retry a job |
Returns
Promise<void>
A promise that resolves when the job has been successfully moved to the wait queue. The queue emits a waiting event when the job is successfully moved.
Throws
Will throw an error if the job does not exist, is locked, or is not in the expected state.
toJSON()
toJSON(): Omit<this,
| "queue"
| "scripts"
| "toJSON"
| "asJSON"
| "asJSONSandbox"
| "updateData"
| "updateProgress"
| "log"
| "removeChildDependency"
| "clearLogs"
| "remove"
| "removeUnprocessedChildren"
| "extendLock"
| "moveToCompleted"
| "moveToWait"
| "moveToFailed"
| "isCompleted"
| "isFailed"
| "isDelayed"
| "isWaitingChildren"
| "isActive"
| "isWaiting"
| "queueName"
| "prefix"
| "getState"
| "changeDelay"
| "changePriority"
| "getChildrenValues"
| "getIgnoredChildrenFailures"
| "getFailedChildrenValues"
| "getDependencies"
| "getDependenciesCount"
| "waitUntilFinished"
| "moveToDelayed"
| "moveToWaitingChildren"
| "promote"
| "retry"
| "discard"
| "addJob"
| "removeDeduplicationKey">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:203
Returns
Omit<this,
| "queue"
| "scripts"
| "toJSON"
| "asJSON"
| "asJSONSandbox"
| "updateData"
| "updateProgress"
| "log"
| "removeChildDependency"
| "clearLogs"
| "remove"
| "removeUnprocessedChildren"
| "extendLock"
| "moveToCompleted"
| "moveToWait"
| "moveToFailed"
| "isCompleted"
| "isFailed"
| "isDelayed"
| "isWaitingChildren"
| "isActive"
| "isWaiting"
| "queueName"
| "prefix"
| "getState"
| "changeDelay"
| "changePriority"
| "getChildrenValues"
| "getIgnoredChildrenFailures"
| "getFailedChildrenValues"
| "getDependencies"
| "getDependenciesCount"
| "waitUntilFinished"
| "moveToDelayed"
| "moveToWaitingChildren"
| "promote"
| "retry"
| "discard"
| "addJob"
| "removeDeduplicationKey">
updateData()
updateData(data): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:220
Updates a job's data
Parameters
| Parameter | Type | Description |
|---|---|---|
data | DataType | the data that will replace the current jobs data. |
Returns
Promise<void>
Implementation of
updateProgress()
updateProgress(progress): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:226
Updates a job's progress
Parameters
| Parameter | Type | Description |
|---|---|---|
progress | JobProgress | number or object to be saved as progress. |
Returns
Promise<void>
Implementation of
updateStacktrace()
protected updateStacktrace(err): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:488
Parameters
| Parameter | Type |
|---|---|
err | Error |
Returns
void
validateOptions()
protected validateOptions(jobData): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:487
Parameters
| Parameter | Type |
|---|---|
jobData | JobJson |
Returns
void
waitUntilFinished()
waitUntilFinished(queueEvents, ttl?): Promise<ReturnType>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:436
Returns a promise the resolves when the job has completed (containing the return value of the job), or rejects when the job has failed (containing the failedReason).
Parameters
| Parameter | Type | Description |
|---|---|---|
queueEvents | QueueEvents | Instance of QueueEvents. |
ttl? | number | Time in milliseconds to wait for job to finish before timing out. |
Returns
Promise<ReturnType>
addJobLog()
static addJobLog(
queue,
jobId,
logRow,
keepLogs?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:202
addJobLog
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | MinimalQueue | A minimal queue instance |
jobId | string | Job id |
logRow | string | String with a row of log data to be logged |
keepLogs? | number | The optional amount of log entries to preserve |
Returns
Promise<number>
The total number of log entries for this job so far.
create()
static create<T, R, N>(
queue,
name,
data,
opts?): Promise<Job<T, R, N>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:160
Creates a new job and adds it to the queue.
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | MinimalQueue | the queue where to add the job. |
name | N | the name of the job. |
data | T | the payload of the job. |
opts? | JobsOptions | the options bag for this job. |
Returns
Promise<Job<T, R, N>>
createBulk()
static createBulk<T, R, N>(queue, jobs): Promise<Job<T, R, N>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:168
Creates a bulk of jobs and adds them atomically to the given queue.
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | MinimalQueue | the queue were to add the jobs. |
jobs | { data: T; name: N; opts?: BulkJobOptions; }[] | an array of jobs to be added to the queue. |
Returns
Promise<Job<T, R, N>[]>
fromId()
static fromId<T, R, N>(queue, jobId): Promise<Job<T, R, N> | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:191
Fetches a Job from the queue given the passed job id.
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | MinimalQueue | the queue where the job belongs to. |
jobId | string | the job id. |
Returns
Promise<Job<T, R, N> | undefined>
fromJSON()
static fromJSON<T, R, N>(
queue,
json,
jobId?): Job<T, R, N>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:181
Instantiates a Job from a JobJsonRaw object (coming from a deserialized JSON object)
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
queue | MinimalQueue | the queue where the job belongs to. |
json | JobJsonRaw | the plain object containing the job. |
jobId? | string | an optional job id (overrides the id coming from the JSON object) |
Returns
Job<T, R, N>
optsAsJSON()
static optsAsJSON(opts?, optsEncode?): RedisJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:209
Parameters
| Parameter | Type |
|---|---|
opts? | JobsOptions |
optsEncode? | Record<string, string> |
Returns
optsFromJSON()
static optsFromJSON(rawOpts?, optsDecode?): JobsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:183
Parameters
| Parameter | Type |
|---|---|
rawOpts? | string |
optsDecode? | Record<string, string> |
Returns
JobScheduler
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:6
Base class for all classes that need to interact with queues. This class is normally not used directly, but extended by the other classes.
Extends
Constructors
Constructor
new JobScheduler(
name,
opts,
Connection?): JobScheduler;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:8
Parameters
| Parameter | Type |
|---|---|
name | string |
opts | RepeatBaseOptions |
Connection? | typeof RedisConnection |
Returns
Overrides
Properties
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
Inherited from
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Inherited from
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
Inherited from
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
Inherited from
QueueBase.hasBlockingConnection
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Inherited from
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Inherited from
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:15
Inherited from
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Inherited from
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
Inherited from
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
QueueBase.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
Inherited from
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
QueueBase.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
Inherited from
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
Inherited from
QueueBase.checkConnectionError
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
Inherited from
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:60
Closes the connection and returns a promise that resolves when the connection is closed.
Returns
Promise<void>
Inherited from
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
Inherited from
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
Inherited from
emit()
emit(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:52
Emits an event. Normally used by subclasses to emit events.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | symbol | The emitted event. |
...args | any[] | - |
Returns
boolean
Inherited from
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
getJobSchedulers()
getJobSchedulers<D>(
start?,
end?,
asc?): Promise<JobSchedulerJson<D>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:20
Type Parameters
| Type Parameter |
|---|
D |
Parameters
| Parameter | Type |
|---|---|
start? | number |
end? | number |
asc? | boolean |
Returns
Promise<JobSchedulerJson<D>[]>
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
getScheduler()
getScheduler<D>(id): Promise<JobSchedulerJson<D> | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:18
Type Parameters
| Type Parameter |
|---|
D |
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<JobSchedulerJson<D> | undefined>
getSchedulersCount()
getSchedulersCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:21
Returns
Promise<number>
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Inherited from
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
removeJobScheduler()
removeJobScheduler(jobSchedulerId): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:14
Parameters
| Parameter | Type |
|---|---|
jobSchedulerId | string |
Returns
Promise<number>
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Inherited from
upsertJobScheduler()
upsertJobScheduler<T, R, N>(
jobSchedulerId,
repeatOpts,
jobName,
jobData,
opts,
__namedParameters): Promise<Job<T, R, N> | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:9
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type |
|---|---|
jobSchedulerId | string |
repeatOpts | Omit<RepeatOptions, "key" | "prevMillis"> |
jobName | N |
jobData | T |
opts | JobSchedulerTemplateOptions |
__namedParameters | { override: boolean; producerId?: string; } |
__namedParameters.override | boolean |
__namedParameters.producerId? | string |
Returns
Promise<Job<T, R, N> | undefined>
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:53
Returns
Promise<RedisClient>
Inherited from
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
LockManager
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:36
Manages lock renewal for BullMQ workers. It periodically extends locks for active jobs to prevent them from being considered stalled by other workers.
Constructors
Constructor
new LockManager(worker, opts): LockManager;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:46
Parameters
| Parameter | Type |
|---|---|
worker | LockManagerWorkerContext |
opts | LockManagerOptions |
Returns
Properties
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:45
lockRenewalTimer?
protected optional lockRenewalTimer: Timeout;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:39
opts
protected opts: LockManagerOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:38
trackedJobs
protected trackedJobs: Map<string, {
abortController?: AbortController;
token: string;
ts: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:40
worker
protected worker: LockManagerWorkerContext;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:37
Methods
cancelAllJobs()
cancelAllJobs(reason?): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:85
Cancels all tracked jobs by aborting their signals.
Parameters
| Parameter | Type | Description |
|---|---|---|
reason? | string | Optional reason for the cancellation |
Returns
void
cancelJob()
cancelJob(jobId, reason?): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:80
Cancels a specific job by aborting its signal.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | The ID of the job to cancel |
reason? | string | Optional reason for the cancellation |
Returns
boolean
true if the job was found and cancelled, false otherwise
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:56
Stops the lock manager and clears all timers.
Returns
Promise<void>
extendLocks()
protected extendLocks(jobIds): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:51
Parameters
| Parameter | Type |
|---|---|
jobIds | string[] |
Returns
Promise<void>
getActiveJobCount()
getActiveJobCount(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:69
Gets the number of jobs currently being tracked.
Returns
number
getTrackedJobIds()
getTrackedJobIds(): string[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:90
Gets a list of all tracked job IDs.
Returns
string[]
Array of job IDs currently being tracked
isRunning()
isRunning(): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:73
Checks if the lock manager is running.
Returns
boolean
start()
start(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:50
Starts the lock manager timers for lock renewal.
Returns
void
trackJob()
trackJob(
jobId,
token,
ts,
shouldCreateController?): AbortController | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:61
Adds a job to be tracked for lock renewal. Returns an AbortController if shouldCreateController is true, undefined otherwise.
Parameters
| Parameter | Type |
|---|---|
jobId | string |
token | string |
ts | number |
shouldCreateController? | boolean |
Returns
AbortController | undefined
untrackJob()
untrackJob(jobId): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:65
Removes a job from lock renewal tracking.
Parameters
| Parameter | Type |
|---|---|
jobId | string |
Returns
void
ProcessorDecoratorService
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/instrument/processor-decorator.service.d.ts:2
Constructors
Constructor
new ProcessorDecoratorService(): ProcessorDecoratorService;
Returns
Methods
decorate()
decorate(processor): Processor<unknown, unknown>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/instrument/processor-decorator.service.d.ts:10
Decorates a processor function. This method can be overridden to provide custom behavior for processor decoration.
Parameters
| Parameter | Type | Description |
|---|---|---|
processor | Processor<unknown, unknown> | The processor function to decorate |
Returns
Processor<unknown, unknown>
The decorated processor function
Queue
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:101
Queue
This class provides methods to add jobs to a queue and some other high-level administration such as pausing or deleting queues.
Example
import { Queue } from 'bullmq';
interface MyDataType {
foo: string;
}
interface MyResultType {
bar: string;
}
const queue = new Queue<MyDataType, MyResultType, "blue" | "brown">('myQueue');
Extends
QueueGetters<JobBase<DataTypeOrJob,ResultType,NameType>>
Type Parameters
| Type Parameter | Description |
|---|---|
DataTypeOrJob | - |
DefaultResultType | - |
DefaultNameType extends string | - |
DataType | The type of the data that the job will process. |
ResultType | The type of the result of the job. |
NameType extends string | The type of the name of the job. |
Constructors
Constructor
new Queue<DataTypeOrJob, DefaultResultType, DefaultNameType, DataType, ResultType, NameType>(
name,
opts?,
Connection?): Queue<DataTypeOrJob, DefaultResultType, DefaultNameType, DataType, ResultType, NameType>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:108
Parameters
| Parameter | Type |
|---|---|
name | string |
opts? | QueueOptions |
Connection? | typeof RedisConnection |
Returns
Queue<DataTypeOrJob, DefaultResultType, DefaultNameType, DataType, ResultType, NameType>
Overrides
Properties
_jobScheduler?
protected optional _jobScheduler: JobScheduler;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:107
_repeat?
protected optional _repeat: Repeat;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:106
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
Inherited from
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Inherited from
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
Inherited from
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
Inherited from
QueueGetters.hasBlockingConnection
jobsOpts
jobsOpts: BaseJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:103
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Inherited from
libName
protected libName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:105
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Inherited from
opts
opts: QueueOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:104
Overrides
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Inherited from
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
Inherited from
token
token: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:102
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
QueueGetters.captureRejections
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
QueueGetters.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
QueueGetters.defaultMaxListeners
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
defaultJobOptions
Get Signature
get defaultJobOptions(): JobsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:116
Returns this instance current default job options.
Returns
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
Inherited from
jobScheduler
Get Signature
get jobScheduler(): Promise<JobScheduler>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:125
Returns
Promise<JobScheduler>
metaValues
Get Signature
get metaValues(): Record<string, string | number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:117
Returns
Record<string, string | number>
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
repeat
Get Signature
get repeat(): Promise<Repeat>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:124
Returns
Promise<Repeat>
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
QueueGetters.[captureRejectionSymbol]
add()
add(
name,
data,
opts?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:155
Adds a new job to the queue.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | NameType | Name of the job to be added to the queue. |
data | DataType | Arbitrary data to append to the job. |
opts? | JobsOptions | Job options that affects how the job is going to be processed. |
Returns
Promise<Job<DataType, ResultType, NameType>>
addBulk()
addBulk(jobs): Promise<Job<DataType, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:174
Adds an array of jobs to the queue. This method may be faster than adding one job at a time in a sequence.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobs | { data: DataType; name: NameType; opts?: BulkJobOptions; }[] | The array of jobs to add to the queue. Each job is defined by 3 properties, 'name', 'data' and 'opts'. They follow the same signature as 'Queue.add'. |
Returns
Promise<Job<DataType, ResultType, NameType>[]>
addJob()
protected addJob(
name,
data,
opts?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:166
addJob is a telemetry free version of the add method, useful in order to wrap it with custom telemetry on subclasses.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | NameType | Name of the job to be added to the queue. |
data | DataType | Arbitrary data to append to the job. |
opts? | JobsOptions | Job options that affects how the job is going to be processed. |
Returns
Promise<Job<DataType, ResultType, NameType>>
Job
addJobLog()
addJobLog(
jobId,
logRow,
keepLogs?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:352
Logs one row of job's log data.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | The job id to log against. |
logRow | string | String with log data to be logged. |
keepLogs? | number | Max number of log entries to keep (0 for unlimited). |
Returns
Promise<number>
The total number of log entries for this job so far.
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
Inherited from
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
Inherited from
QueueGetters.checkConnectionError
clean()
clean(
grace,
limit,
type?): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:371
Cleans jobs from a queue. Similar to drain but keeps jobs within a certain grace period.
Parameters
| Parameter | Type | Description |
|---|---|---|
grace | number | The grace period in milliseconds |
limit | number | Max number of jobs to clean |
type? | | "wait" | "completed" | "failed" | "active" | "delayed" | "prioritized" | "waiting" | "paused" | The type of job to clean Possible values are completed, wait, active, paused, delayed, failed. Defaults to completed. |
Returns
Promise<string[]>
Id jobs from the deleted records
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
Inherited from
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:214
Close the queue instance.
Returns
Promise<void>
Overrides
count()
count(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:16
Returns the number of jobs waiting to be processed. This includes jobs that are "waiting" or "delayed" or "prioritized" or "waiting-children".
Returns
Promise<number>
Inherited from
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
Inherited from
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
Inherited from
drain()
drain(delayed?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:360
Drains the queue, i.e., removes all jobs that are waiting or delayed, but not active, completed or failed.
Parameters
| Parameter | Type | Description |
|---|---|---|
delayed? | boolean | Pass true if it should also clean the delayed jobs. |
Returns
Promise<void>
emit()
emit<U>(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:109
Emits an event. Normally used by subclasses to emit events.
Type Parameters
| Type Parameter |
|---|
U extends keyof QueueListener<JobBase<DataType, ResultType, NameType>> |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The emitted event. |
...args | Parameters<QueueListener<JobBase<DataType, ResultType, NameType>>[U]> | - |
Returns
boolean
Overrides
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
exportPrometheusMetrics()
exportPrometheusMetrics(globalVariables?): Promise<string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:260
Export the metrics for the queue in the Prometheus format. Automatically exports all the counts returned by getJobCounts().
Parameters
| Parameter | Type |
|---|---|
globalVariables? | Record<string, string> |
Returns
Promise<string>
- Returns a string with the metrics in the Prometheus format.
See
https://prometheus.io/docs/instrumenting/exposition_formats/
Inherited from
QueueGetters.exportPrometheusMetrics
getActive()
getActive(start?, end?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:135
Returns the jobs that are in the "active" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
getActiveCount()
getActiveCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:98
Returns the number of jobs in active status.
Returns
Promise<number>
Inherited from
getCompleted()
getCompleted(start?, end?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:153
Returns the jobs that are in the "completed" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
getCompletedCount()
getCompletedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:86
Returns
Promise<number>
Returns the number of jobs in completed status.
Inherited from
QueueGetters.getCompletedCount
getCountsPerPriority()
getCountsPerPriority(priorities): Promise<{
[index: string]: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:106
Returns the number of jobs per priority.
Parameters
| Parameter | Type |
|---|---|
priorities | number[] |
Returns
Promise<{
[index: string]: number;
}>
Inherited from
QueueGetters.getCountsPerPriority
getDebounceJobId()
getDebounceJobId(id): Promise<string | null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:32
Get jobId that starts debounced state.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | debounce identifier |
Returns
Promise<string | null>
Deprecated
use getDeduplicationJobId method
Inherited from
getDeduplicationJobId()
getDeduplicationJobId(id): Promise<string | null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:38
Get jobId from deduplicated state.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | deduplication identifier |
Returns
Promise<string | null>
Inherited from
QueueGetters.getDeduplicationJobId
getDelayed()
getDelayed(start?, end?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:141
Returns the jobs that are in the "delayed" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
getDelayedCount()
getDelayedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:94
Returns the number of jobs in delayed status.
Returns
Promise<number>
Inherited from
getDependencies()
getDependencies(
parentId,
type,
start,
end): Promise<{
items: {
err?: string;
id: string;
v?: any;
}[];
jobs: JobJsonRaw[];
total: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:177
Returns the qualified job ids and the raw job data (if available) of the children jobs of the given parent job. It is possible to get either the already processed children, in this case an array of qualified job ids and their result values will be returned, or the pending children, in this case an array of qualified job ids will be returned. A qualified job id is a string representing the job id in a given queue, for example: "bull:myqueue:jobid".
Parameters
| Parameter | Type | Description |
|---|---|---|
parentId | string | The id of the parent job |
type | "processed" | "pending" | "processed" |
start | number | - |
end | number | - |
Returns
Promise<{
items: {
err?: string;
id: string;
v?: any;
}[];
jobs: JobJsonRaw[];
total: number;
}>
an object with the following shape:
{ items: { id: string, v?: any, err?: string } [], jobs: JobJsonRaw[], total: number}
Inherited from
getFailed()
getFailed(start?, end?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:159
Returns the jobs that are in the "failed" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
getFailedCount()
getFailedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:90
Returns the number of jobs in failed status.
Returns
Promise<number>
Inherited from
getGlobalConcurrency()
getGlobalConcurrency(): Promise<number | null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:43
Get global concurrency value. Returns null in case no value is set.
Returns
Promise<number | null>
Inherited from
QueueGetters.getGlobalConcurrency
getGlobalRateLimit()
getGlobalRateLimit(): Promise<
| {
duration: number;
max: number;
}
| null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:48
Get global rate limit values. Returns null in case no value is set.
Returns
Promise<
| {
duration: number;
max: number;
}
| null>
Inherited from
QueueGetters.getGlobalRateLimit
getJob()
getJob(jobId): Promise<JobBase<DataTypeOrJob, ResultType, NameType> | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:9
Parameters
| Parameter | Type |
|---|---|
jobId | string |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType> | undefined>
Inherited from
getJobCountByTypes()
getJobCountByTypes(...types): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:60
Job counts by type
Queue#getJobCountByTypes('completed') =\> completed count Queue#getJobCountByTypes('completed,failed') =\> completed + failed count Queue#getJobCountByTypes('completed', 'failed') =\> completed + failed count Queue#getJobCountByTypes('completed', 'waiting', 'failed') =\> completed + waiting + failed count
Parameters
| Parameter | Type |
|---|---|
...types | JobType[] |
Returns
Promise<number>
Inherited from
QueueGetters.getJobCountByTypes
getJobCounts()
getJobCounts(...types): Promise<{
[index: string]: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:66
Returns the job counts for each type specified or every list/set in the queue by default.
Parameters
| Parameter | Type |
|---|---|
...types | JobType[] |
Returns
Promise<{
[index: string]: number;
}>
An object, key (type) and value (count)
Inherited from
getJobLogs()
getJobLogs(
jobId,
start?,
end?,
asc?): Promise<{
count: number;
logs: string[];
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:202
Returns the logs for a given Job.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | the id of the job to get the logs for. |
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
asc? | boolean | if true, the jobs will be returned in ascending order. |
Returns
Promise<{
count: number;
logs: string[];
}>
Inherited from
getJobs()
getJobs(
types?,
start?,
end?,
asc?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:194
Returns the jobs that are on the given statuses (note that JobType is synonym for job status)
Parameters
| Parameter | Type | Description |
|---|---|---|
types? | JobType | JobType[] | the statuses of the jobs to return. |
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
asc? | boolean | if true, the jobs will be returned in ascending order. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
getJobScheduler()
getJobScheduler(id): Promise<JobSchedulerJson<DataType> | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:252
Get Job Scheduler by id
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | identifier of scheduler. |
Returns
Promise<JobSchedulerJson<DataType> | undefined>
getJobSchedulers()
getJobSchedulers(
start?,
end?,
asc?): Promise<JobSchedulerJson<DataType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:261
Get all Job Schedulers
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | Offset of first scheduler to return. |
end? | number | Offset of last scheduler to return. |
asc? | boolean | Determine the order in which schedulers are returned based on their next execution time. |
Returns
Promise<JobSchedulerJson<DataType>[]>
getJobSchedulersCount()
getJobSchedulersCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:268
Get the number of job schedulers.
Returns
Promise<number>
The number of job schedulers.
getJobState()
getJobState(jobId): Promise<JobState | "unknown">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:76
Get current job state.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | job identifier. |
Returns
Promise<JobState | "unknown">
Returns one of these values: 'completed', 'failed', 'delayed', 'active', 'waiting', 'waiting-children', 'unknown'.
Inherited from
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
getMeta()
getMeta(): Promise<QueueMeta>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:82
Get global queue configuration.
Returns
Promise<QueueMeta>
Returns the global queue configuration.
Inherited from
getMetrics()
getMetrics(
type,
start?,
end?): Promise<Metrics>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:249
Get queue metrics related to the queue.
This method returns the gathered metrics for the queue. The metrics are represented as an array of job counts per unit of time (1 minute).
Parameters
| Parameter | Type | Description |
|---|---|---|
type | "completed" | "failed" | - |
start? | number | Start point of the metrics, where 0 is the newest point to be returned. |
end? | number | End point of the metrics, where -1 is the oldest point to be returned. |
Returns
Promise<Metrics>
- Returns an object with queue metrics.
Inherited from
getPrioritized()
getPrioritized(start?, end?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:147
Returns the jobs that are in the "prioritized" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
getPrioritizedCount()
getPrioritizedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:102
Returns the number of jobs in prioritized status.
Returns
Promise<number>
Inherited from
QueueGetters.getPrioritizedCount
getQueueEvents()
getQueueEvents(): Promise<{
[index: string]: string;
}[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:232
Get queue events list related to the queue. Note: GCP does not support SETNAME, so this call will not work
Returns
Promise<{
[index: string]: string;
}[]>
- Returns an array with queue events info.
Deprecated
do not use this method, it will be removed in the future.
Inherited from
getRanges()
getRanges(
types,
start?,
end?,
asc?): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:186
Parameters
| Parameter | Type |
|---|---|
types | JobType[] |
start? | number |
end? | number |
asc? | boolean |
Returns
Promise<string[]>
Inherited from
getRateLimitTtl()
getRateLimitTtl(maxJobs?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:25
Returns the time to live for a rate limited key in milliseconds.
Parameters
| Parameter | Type | Description |
|---|---|---|
maxJobs? | number | max jobs to be considered in rate limit state. If not passed it will return the remaining ttl without considering if max jobs is excedeed. |
Returns
Promise<number>
-2 if the key does not exist. -1 if the key exists but has no associated expire.
See
https://redis.io/commands/pttl/
Inherited from
getRepeatableJobs()
getRepeatableJobs(
start?,
end?,
asc?): Promise<RepeatableJob[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:246
Get all repeatable meta jobs.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | Offset of first job to return. |
end? | number | Offset of last job to return. |
asc? | boolean | Determine the order in which jobs are returned based on their next execution time. |
Returns
Promise<RepeatableJob[]>
Deprecated
This method is deprecated and will be removed in v6. Use getJobSchedulers instead.
getVersion()
getVersion(): Promise<string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:123
Get library version.
Returns
Promise<string>
the content of the meta.library field.
getWaiting()
getWaiting(start?, end?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:122
Returns the jobs that are in the "waiting" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
getWaitingChildren()
getWaitingChildren(start?, end?): Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:129
Returns the jobs that are in the "waiting-children" status. I.E. parent jobs that have at least one child that has not completed yet.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase<DataTypeOrJob, ResultType, NameType>[]>
Inherited from
QueueGetters.getWaitingChildren
getWaitingChildrenCount()
getWaitingChildrenCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:116
Returns the number of jobs in waiting-children status.
Returns
Promise<number>
Inherited from
QueueGetters.getWaitingChildrenCount
getWaitingCount()
getWaitingCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:112
Returns the number of jobs in waiting or paused statuses.
Returns
Promise<number>
Inherited from
getWorkers()
getWorkers(): Promise<{
[index: string]: string;
}[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:214
Get the worker list related to the queue. i.e. all the known workers that are available to process jobs for this queue. Note: GCP does not support SETNAME, so this call will not work
Returns
Promise<{
[index: string]: string;
}[]>
- Returns an array with workers info.
Inherited from
getWorkersCount()
getWorkersCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:223
Returns the current count of workers for the queue.
getWorkersCount(): Promise<number>
Returns
Promise<number>
Inherited from
isMaxed()
isMaxed(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:235
Returns true if the queue is currently maxed.
Returns
Promise<boolean>
isPaused()
isPaused(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:231
Returns true if the queue is currently paused.
Returns
Promise<boolean>
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
obliterate()
obliterate(opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:383
Completely destroys the queue and all of its contents irreversibly. This method will pause the queue and requires that there are no active jobs. It is possible to bypass this requirement, i.e. not having active jobs using the "force" option.
Note: This operation requires to iterate on all the jobs stored in the queue and can be slow for very large queues.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | ObliterateOpts | Obliterate options. |
Returns
Promise<void>
off()
off<U>(eventName, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:110
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
U extends keyof QueueListener<JobBase<DataType, ResultType, NameType>> |
Parameters
| Parameter | Type |
|---|---|
eventName | U |
listener | QueueListener<JobBase<DataType, ResultType, NameType>>[U] |
Returns
this
Since
v10.0.0
Overrides
on()
on<U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:111
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
U extends keyof QueueListener<JobBase<DataType, ResultType, NameType>> |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The name of the event. |
listener | QueueListener<JobBase<DataType, ResultType, NameType>>[U] | The callback function |
Returns
this
Since
v0.1.101
Overrides
once()
once<U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:112
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
U extends keyof QueueListener<JobBase<DataType, ResultType, NameType>> |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The name of the event. |
listener | QueueListener<JobBase<DataType, ResultType, NameType>>[U] | The callback function |
Returns
this
Since
v0.3.0
Overrides
pause()
pause(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:209
Pauses the processing of this queue globally.
We use an atomic RENAME operation on the wait queue. Since we have blocking calls with BRPOPLPUSH on the wait queue, as long as the queue is renamed to 'paused', no new jobs will be processed (the current ones will run until finalized).
Adding jobs requires a LUA script to check first if the paused list exist and in that case it will add it there instead of the wait list.
Returns
Promise<void>
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
QueueGetters.prependOnceListener
promoteJobs()
promoteJobs(opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:407
Promote all the delayed jobs.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | { count?: number; } | An object with the following properties: - count number to limit how many jobs will be moved to wait status per iteration |
opts.count? | number | - |
Returns
Promise<void>
rateLimit()
rateLimit(expireTimeMs): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:220
Overrides the rate limit to be active for the next jobs.
Parameters
| Parameter | Type | Description |
|---|---|---|
expireTimeMs | number | expire time in ms of this rate limit. |
Returns
Promise<void>
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
remove()
remove(jobId, opts?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:333
Removes the given job from the queue as well as all its dependencies.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | The id of the job to remove |
opts? | { removeChildren?: boolean; } | Options to remove a job |
opts.removeChildren? | boolean | - |
Returns
Promise<number>
1 if it managed to remove the job or 0 if the job or any of its dependencies were locked.
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
QueueGetters.removeAllListeners
removeDebounceKey()
removeDebounceKey(id): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:300
Removes a debounce key.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | debounce identifier |
Returns
Promise<number>
Deprecated
use removeDeduplicationKey
removeDeduplicationKey()
removeDeduplicationKey(id): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:306
Removes a deduplication key.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | identifier |
Returns
Promise<number>
removeDeprecatedPriorityKey()
removeDeprecatedPriorityKey(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:419
Delete old priority helper key.
Returns
Promise<number>
removeGlobalConcurrency()
removeGlobalConcurrency(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:143
Remove global concurrency value.
Returns
Promise<number>
removeGlobalRateLimit()
removeGlobalRateLimit(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:147
Remove global rate limit values.
Returns
Promise<number>
removeJobScheduler()
removeJobScheduler(jobSchedulerId): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:293
Removes a job scheduler.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobSchedulerId | string | identifier of the job scheduler. |
Returns
Promise<boolean>
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
removeRateLimitKey()
removeRateLimitKey(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:310
Removes rate limit key.
Returns
Promise<number>
removeRepeatable()
removeRepeatable(
name,
repeatOpts,
jobId?): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:284
Removes a repeatable job.
Note: you need to use the exact same repeatOpts when deleting a repeatable job than when adding it.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | NameType | Job name |
repeatOpts | RepeatOptions | Repeat options |
jobId? | string | Job id to remove. If not provided, all jobs with the same repeatOpts |
Returns
Promise<boolean>
Deprecated
This method is deprecated and will be removed in v6. Use removeJobScheduler instead.
See
removeRepeatableByKey
removeRepeatableByKey()
removeRepeatableByKey(key): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:323
Removes a repeatable job by its key. Note that the key is the one used to store the repeatable job metadata and not one of the job iterations themselves. You can use "getRepeatableJobs" in order to get the keys.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
Promise<boolean>
See
getRepeatableJobs
Deprecated
This method is deprecated and will be removed in v6. Use removeJobScheduler instead.
resume()
resume(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:227
Resumes the processing of this queue globally.
The method reverses the pause operation by resuming the processing of the queue.
Returns
Promise<void>
retryJobs()
retryJobs(opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:394
Retry all the failed or completed jobs.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | { count?: number; state?: FinishedStatus; timestamp?: number; } | An object with the following properties: - count number to limit how many jobs will be moved to wait status per iteration, - state failed by default or completed. - timestamp from which timestamp to start moving jobs to wait status, default Date.now(). |
opts.count? | number | - |
opts.state? | FinishedStatus | - |
opts.timestamp? | number | - |
Returns
Promise<void>
setGlobalConcurrency()
setGlobalConcurrency(concurrency): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:133
Enable and set global concurrency value.
Parameters
| Parameter | Type | Description |
|---|---|---|
concurrency | number | Maximum number of simultaneous jobs that the workers can handle. For instance, setting this value to 1 ensures that no more than one job is processed at any given time. If this limit is not defined, there will be no restriction on the number of concurrent jobs. |
Returns
Promise<number>
setGlobalRateLimit()
setGlobalRateLimit(max, duration): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:139
Enable and set rate limit.
Parameters
| Parameter | Type | Description |
|---|---|---|
max | number | Max number of jobs to process in the time period specified in duration |
duration | number | Time in milliseconds. During this time, a maximum of max jobs will be processed. |
Returns
Promise<number>
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Inherited from
trimEvents()
trimEvents(maxLength): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:415
Trim the event stream to an approximately maxLength.
Parameters
| Parameter | Type |
|---|---|
maxLength | number |
Returns
Promise<number>
updateJobProgress()
updateJobProgress(jobId, progress): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:342
Updates the given job's progress.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | The id of the job to update |
progress | JobProgress | Number or object to be saved as progress. |
Returns
Promise<void>
upsertJobScheduler()
upsertJobScheduler(
jobSchedulerId,
repeatOpts,
jobTemplate?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:193
Upserts a scheduler.
A scheduler is a job factory that creates jobs at a given interval. Upserting a scheduler will create a new job scheduler or update an existing one. It will also create the first job based on the repeat options and delayed accordingly.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobSchedulerId | NameType | - |
repeatOpts | Omit<RepeatOptions, "key"> | Repeat options |
jobTemplate? | { data?: DataType; name?: NameType; opts?: JobSchedulerTemplateOptions; } | Job template. If provided it will be used for all the jobs created by the scheduler. |
jobTemplate.data? | DataType | - |
jobTemplate.name? | NameType | - |
jobTemplate.opts? | JobSchedulerTemplateOptions | - |
Returns
Promise<Job<DataType, ResultType, NameType>>
The next job to be scheduled (would normally be in delayed state).
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:53
Returns
Promise<RedisClient>
Inherited from
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
QueueGetters.getEventListeners
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
QueueBase
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:13
Base class for all classes that need to interact with queues. This class is normally not used directly, but extended by the other classes.
Extends
EventEmitter
Extended by
Implements
Constructors
Constructor
new QueueBase(
name,
opts?,
Connection?,
hasBlockingConnection?): QueueBase;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:31
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the queue. |
opts? | QueueBaseOptions | Options for the queue. |
Connection? | typeof RedisConnection | An optional "Connection" class used to instantiate a Connection. This is useful for testing with mockups and/or extending the Connection class and passing an alternate implementation. |
hasBlockingConnection? | boolean | - |
Returns
Overrides
EventEmitter.constructor
Properties
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Implementation of
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Implementation of
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Implementation of
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:15
Implementation of
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Implementation of
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Implementation of
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejections
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
EventEmitter.defaultMaxListeners
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
EventEmitter.errorMonitor
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Implementation of
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Implementation of
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
EventEmitter.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.addListener
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:60
Closes the connection and returns a promise that resolves when the connection is closed.
Returns
Promise<void>
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
emit()
emit(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:52
Emits an event. Normally used by subclasses to emit events.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | symbol | The emitted event. |
...args | any[] | - |
Returns
boolean
Implementation of
Overrides
EventEmitter.emit
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
EventEmitter.eventNames
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
EventEmitter.listenerCount
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
EventEmitter.listeners
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
EventEmitter.off
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Implementation of
Inherited from
EventEmitter.on
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
EventEmitter.once
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependListener
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependOnceListener
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
EventEmitter.rawListeners
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeAllListeners
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Implementation of
Inherited from
EventEmitter.removeListener
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
EventEmitter.setMaxListeners
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Implementation of
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:53
Returns
Promise<RedisClient>
Implementation of
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
EventEmitter.addAbortListener
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
EventEmitter.getEventListeners
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
EventEmitter.listenerCount
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
EventEmitter.setMaxListeners
QueueEvents
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:270
The QueueEvents class is used for listening to the global events emitted by a given queue.
This class requires a dedicated redis connection.
Extends
Constructors
Constructor
new QueueEvents(
name,
__namedParameters?,
Connection?): QueueEvents;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:273
Parameters
| Parameter | Type |
|---|---|
name | string |
__namedParameters? | QueueEventsOptions |
Connection? | typeof RedisConnection |
Returns
Overrides
Properties
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
Inherited from
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Inherited from
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
Inherited from
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
Inherited from
QueueBase.hasBlockingConnection
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Inherited from
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Inherited from
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:15
Inherited from
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Inherited from
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
Inherited from
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
QueueBase.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
Inherited from
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
QueueBase.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
Inherited from
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
Inherited from
QueueBase.checkConnectionError
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
Inherited from
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:289
Stops consuming events and close the underlying Redis connection if necessary.
Returns
Promise<void>
Overrides
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
Inherited from
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
Inherited from
emit()
emit<QEL, U>(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:274
Emits an event. Normally used by subclasses to emit events.
Type Parameters
| Type Parameter |
|---|
QEL extends QueueEventsListener |
U extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The emitted event. |
...args | CustomParameters<QEL[U]> | - |
Returns
boolean
Overrides
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
off()
off<QEL, U>(eventName, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:275
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
QEL extends QueueEventsListener |
U extends string |
Parameters
| Parameter | Type |
|---|---|
eventName | U |
listener | QEL[U] |
Returns
this
Since
v10.0.0
Overrides
on()
on<QEL, U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:276
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
QEL extends QueueEventsListener |
U extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The name of the event. |
listener | QEL[U] | The callback function |
Returns
this
Since
v0.1.101
Overrides
once()
once<QEL, U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:277
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
QEL extends QueueEventsListener |
U extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The name of the event. |
listener | QEL[U] | The callback function |
Returns
this
Since
v0.3.0
Overrides
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
run()
run(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events.d.ts:282
Manually starts running the event consumming loop. This shall be used if you do not use the default "autorun" option on the constructor.
Returns
Promise<void>
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Inherited from
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:53
Returns
Promise<RedisClient>
Inherited from
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
abstract QueueEventsHost
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/hosts/queue-events-host.class.d.ts:3
Type Parameters
| Type Parameter |
|---|
T extends QueueEvents |
Implements
OnApplicationShutdown
Constructors
Constructor
new QueueEventsHost<T>(): QueueEventsHost<T>;
Returns
Accessors
queueEvents
Get Signature
get queueEvents(): T;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/hosts/queue-events-host.class.d.ts:5
Returns
T
Methods
onApplicationShutdown()
onApplicationShutdown(signal?): Promise<void>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/hosts/queue-events-host.class.d.ts:6
Parameters
| Parameter | Type |
|---|---|
signal? | string |
Returns
Promise<void>
Implementation of
OnApplicationShutdown.onApplicationShutdown
QueueEventsProducer
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events-producer.d.ts:7
The QueueEventsProducer class is used for publishing custom events.
Extends
Constructors
Constructor
new QueueEventsProducer(
name,
opts?,
Connection?): QueueEventsProducer;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events-producer.d.ts:8
Parameters
| Parameter | Type |
|---|---|
name | string |
opts? | QueueEventsProducerOptions |
Connection? | typeof RedisConnection |
Returns
Overrides
Properties
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
Inherited from
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Inherited from
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
Inherited from
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
Inherited from
QueueBase.hasBlockingConnection
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Inherited from
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Inherited from
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:15
Inherited from
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Inherited from
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
Inherited from
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
QueueBase.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
Inherited from
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
QueueBase.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
Inherited from
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
Inherited from
QueueBase.checkConnectionError
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
Inherited from
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events-producer.d.ts:20
Closes the connection and returns a promise that resolves when the connection is closed.
Returns
Promise<void>
Overrides
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
Inherited from
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
Inherited from
emit()
emit(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:52
Emits an event. Normally used by subclasses to emit events.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | symbol | The emitted event. |
...args | any[] | - |
Returns
boolean
Inherited from
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Inherited from
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
publishEvent()
publishEvent<T>(argsObj, maxEvents?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-events-producer.d.ts:14
Publish custom event to be processed in QueueEvents.
Type Parameters
| Type Parameter |
|---|
T extends { eventName: string; } |
Parameters
| Parameter | Type | Description |
|---|---|---|
argsObj | T | Event payload |
maxEvents? | number | Max quantity of events to be saved |
Returns
Promise<void>
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Inherited from
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:53
Returns
Promise<RedisClient>
Inherited from
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
QueueGetters
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:8
Provides different getters for different aspects of a queue.
Extends
Extended by
Type Parameters
| Type Parameter |
|---|
JobBase extends Job |
Constructors
Constructor
new QueueGetters<JobBase>(
name,
opts?,
Connection?,
hasBlockingConnection?): QueueGetters<JobBase>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:31
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the queue. |
opts? | QueueBaseOptions | Options for the queue. |
Connection? | typeof RedisConnection | An optional "Connection" class used to instantiate a Connection. This is useful for testing with mockups and/or extending the Connection class and passing an alternate implementation. |
hasBlockingConnection? | boolean | - |
Returns
QueueGetters<JobBase>
Inherited from
Properties
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
Inherited from
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Inherited from
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
Inherited from
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
Inherited from
QueueBase.hasBlockingConnection
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Inherited from
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Inherited from
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:15
Inherited from
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Inherited from
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
Inherited from
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
QueueBase.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
Inherited from
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
QueueBase.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
Inherited from
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
Inherited from
QueueBase.checkConnectionError
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
Inherited from
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:60
Closes the connection and returns a promise that resolves when the connection is closed.
Returns
Promise<void>
Inherited from
count()
count(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:16
Returns the number of jobs waiting to be processed. This includes jobs that are "waiting" or "delayed" or "prioritized" or "waiting-children".
Returns
Promise<number>
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
Inherited from
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
Inherited from
emit()
emit(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:52
Emits an event. Normally used by subclasses to emit events.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | symbol | The emitted event. |
...args | any[] | - |
Returns
boolean
Inherited from
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
exportPrometheusMetrics()
exportPrometheusMetrics(globalVariables?): Promise<string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:260
Export the metrics for the queue in the Prometheus format. Automatically exports all the counts returned by getJobCounts().
Parameters
| Parameter | Type |
|---|---|
globalVariables? | Record<string, string> |
Returns
Promise<string>
- Returns a string with the metrics in the Prometheus format.
See
https://prometheus.io/docs/instrumenting/exposition_formats/
getActive()
getActive(start?, end?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:135
Returns the jobs that are in the "active" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase[]>
getActiveCount()
getActiveCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:98
Returns the number of jobs in active status.
Returns
Promise<number>
getCompleted()
getCompleted(start?, end?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:153
Returns the jobs that are in the "completed" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase[]>
getCompletedCount()
getCompletedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:86
Returns
Promise<number>
Returns the number of jobs in completed status.
getCountsPerPriority()
getCountsPerPriority(priorities): Promise<{
[index: string]: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:106
Returns the number of jobs per priority.
Parameters
| Parameter | Type |
|---|---|
priorities | number[] |
Returns
Promise<{
[index: string]: number;
}>
getDebounceJobId()
getDebounceJobId(id): Promise<string | null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:32
Get jobId that starts debounced state.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | debounce identifier |
Returns
Promise<string | null>
Deprecated
use getDeduplicationJobId method
getDeduplicationJobId()
getDeduplicationJobId(id): Promise<string | null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:38
Get jobId from deduplicated state.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | deduplication identifier |
Returns
Promise<string | null>
getDelayed()
getDelayed(start?, end?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:141
Returns the jobs that are in the "delayed" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase[]>
getDelayedCount()
getDelayedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:94
Returns the number of jobs in delayed status.
Returns
Promise<number>
getDependencies()
getDependencies(
parentId,
type,
start,
end): Promise<{
items: {
err?: string;
id: string;
v?: any;
}[];
jobs: JobJsonRaw[];
total: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:177
Returns the qualified job ids and the raw job data (if available) of the children jobs of the given parent job. It is possible to get either the already processed children, in this case an array of qualified job ids and their result values will be returned, or the pending children, in this case an array of qualified job ids will be returned. A qualified job id is a string representing the job id in a given queue, for example: "bull:myqueue:jobid".
Parameters
| Parameter | Type | Description |
|---|---|---|
parentId | string | The id of the parent job |
type | "processed" | "pending" | "processed" |
start | number | - |
end | number | - |
Returns
Promise<{
items: {
err?: string;
id: string;
v?: any;
}[];
jobs: JobJsonRaw[];
total: number;
}>
an object with the following shape:
{ items: { id: string, v?: any, err?: string } [], jobs: JobJsonRaw[], total: number}
getFailed()
getFailed(start?, end?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:159
Returns the jobs that are in the "failed" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase[]>
getFailedCount()
getFailedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:90
Returns the number of jobs in failed status.
Returns
Promise<number>
getGlobalConcurrency()
getGlobalConcurrency(): Promise<number | null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:43
Get global concurrency value. Returns null in case no value is set.
Returns
Promise<number | null>
getGlobalRateLimit()
getGlobalRateLimit(): Promise<
| {
duration: number;
max: number;
}
| null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:48
Get global rate limit values. Returns null in case no value is set.
Returns
Promise<
| {
duration: number;
max: number;
}
| null>
getJob()
getJob(jobId): Promise<JobBase | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:9
Parameters
| Parameter | Type |
|---|---|
jobId | string |
Returns
Promise<JobBase | undefined>
getJobCountByTypes()
getJobCountByTypes(...types): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:60
Job counts by type
Queue#getJobCountByTypes('completed') =\> completed count Queue#getJobCountByTypes('completed,failed') =\> completed + failed count Queue#getJobCountByTypes('completed', 'failed') =\> completed + failed count Queue#getJobCountByTypes('completed', 'waiting', 'failed') =\> completed + waiting + failed count
Parameters
| Parameter | Type |
|---|---|
...types | JobType[] |
Returns
Promise<number>
getJobCounts()
getJobCounts(...types): Promise<{
[index: string]: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:66
Returns the job counts for each type specified or every list/set in the queue by default.
Parameters
| Parameter | Type |
|---|---|
...types | JobType[] |
Returns
Promise<{
[index: string]: number;
}>
An object, key (type) and value (count)
getJobLogs()
getJobLogs(
jobId,
start?,
end?,
asc?): Promise<{
count: number;
logs: string[];
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:202
Returns the logs for a given Job.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | the id of the job to get the logs for. |
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
asc? | boolean | if true, the jobs will be returned in ascending order. |
Returns
Promise<{
count: number;
logs: string[];
}>
getJobs()
getJobs(
types?,
start?,
end?,
asc?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:194
Returns the jobs that are on the given statuses (note that JobType is synonym for job status)
Parameters
| Parameter | Type | Description |
|---|---|---|
types? | JobType | JobType[] | the statuses of the jobs to return. |
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
asc? | boolean | if true, the jobs will be returned in ascending order. |
Returns
Promise<JobBase[]>
getJobState()
getJobState(jobId): Promise<JobState | "unknown">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:76
Get current job state.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | job identifier. |
Returns
Promise<JobState | "unknown">
Returns one of these values: 'completed', 'failed', 'delayed', 'active', 'waiting', 'waiting-children', 'unknown'.
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
getMeta()
getMeta(): Promise<QueueMeta>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:82
Get global queue configuration.
Returns
Promise<QueueMeta>
Returns the global queue configuration.
getMetrics()
getMetrics(
type,
start?,
end?): Promise<Metrics>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:249
Get queue metrics related to the queue.
This method returns the gathered metrics for the queue. The metrics are represented as an array of job counts per unit of time (1 minute).
Parameters
| Parameter | Type | Description |
|---|---|---|
type | "completed" | "failed" | - |
start? | number | Start point of the metrics, where 0 is the newest point to be returned. |
end? | number | End point of the metrics, where -1 is the oldest point to be returned. |
Returns
Promise<Metrics>
- Returns an object with queue metrics.
getPrioritized()
getPrioritized(start?, end?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:147
Returns the jobs that are in the "prioritized" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase[]>
getPrioritizedCount()
getPrioritizedCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:102
Returns the number of jobs in prioritized status.
Returns
Promise<number>
getQueueEvents()
getQueueEvents(): Promise<{
[index: string]: string;
}[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:232
Get queue events list related to the queue. Note: GCP does not support SETNAME, so this call will not work
Returns
Promise<{
[index: string]: string;
}[]>
- Returns an array with queue events info.
Deprecated
do not use this method, it will be removed in the future.
getRanges()
getRanges(
types,
start?,
end?,
asc?): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:186
Parameters
| Parameter | Type |
|---|---|
types | JobType[] |
start? | number |
end? | number |
asc? | boolean |
Returns
Promise<string[]>
getRateLimitTtl()
getRateLimitTtl(maxJobs?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:25
Returns the time to live for a rate limited key in milliseconds.
Parameters
| Parameter | Type | Description |
|---|---|---|
maxJobs? | number | max jobs to be considered in rate limit state. If not passed it will return the remaining ttl without considering if max jobs is excedeed. |
Returns
Promise<number>
-2 if the key does not exist. -1 if the key exists but has no associated expire.
See
https://redis.io/commands/pttl/
getWaiting()
getWaiting(start?, end?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:122
Returns the jobs that are in the "waiting" status.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase[]>
getWaitingChildren()
getWaitingChildren(start?, end?): Promise<JobBase[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:129
Returns the jobs that are in the "waiting-children" status. I.E. parent jobs that have at least one child that has not completed yet.
Parameters
| Parameter | Type | Description |
|---|---|---|
start? | number | zero based index from where to start returning jobs. |
end? | number | zero based index where to stop returning jobs. |
Returns
Promise<JobBase[]>
getWaitingChildrenCount()
getWaitingChildrenCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:116
Returns the number of jobs in waiting-children status.
Returns
Promise<number>
getWaitingCount()
getWaitingCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:112
Returns the number of jobs in waiting or paused statuses.
Returns
Promise<number>
getWorkers()
getWorkers(): Promise<{
[index: string]: string;
}[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:214
Get the worker list related to the queue. i.e. all the known workers that are available to process jobs for this queue. Note: GCP does not support SETNAME, so this call will not work
Returns
Promise<{
[index: string]: string;
}[]>
- Returns an array with workers info.
getWorkersCount()
getWorkersCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts:223
Returns the current count of workers for the queue.
getWorkersCount(): Promise<number>
Returns
Promise<number>
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Inherited from
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Inherited from
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:53
Returns
Promise<RedisClient>
Inherited from
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
QueueKeys
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts:4
Constructors
Constructor
new QueueKeys(prefix?): QueueKeys;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts:6
Parameters
| Parameter | Type |
|---|---|
prefix? | string |
Returns
Properties
prefix
readonly prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts:5
Methods
getKeys()
getKeys(name): KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts:7
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
getQueueQualifiedName()
getQueueQualifiedName(name): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts:9
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
string
toKey()
toKey(name, type): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts:8
Parameters
| Parameter | Type |
|---|---|
name | string |
type | string |
Returns
string
RateLimitError
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/rate-limit-error.d.ts:8
RateLimitError
Error to be thrown when queue reaches a rate limit.
Extends
Error
Constructors
Constructor
new RateLimitError(message?): RateLimitError;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/rate-limit-error.d.ts:9
Parameters
| Parameter | Type |
|---|---|
message? | string |
Returns
Overrides
Error.constructor
Properties
message
message: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.message
name
name: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.name
stack?
optional stack: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
RedisConnection
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:12
Extends
EventEmitter
Constructors
Constructor
new RedisConnection(opts, extraOptions?): RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:28
Parameters
| Parameter | Type |
|---|---|
opts | ConnectionOptions |
extraOptions? | { blocking?: boolean; shared?: boolean; skipVersionCheck?: boolean; skipWaitingForReady?: boolean; } |
extraOptions.blocking? | boolean |
extraOptions.shared? | boolean |
extraOptions.skipVersionCheck? | boolean |
extraOptions.skipWaitingForReady? | boolean |
Returns
Overrides
EventEmitter.constructor
Properties
_client
protected _client: RedisClient;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:19
capabilities
capabilities: RedisCapabilities;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:17
closing
closing: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:16
packageVersion
protected packageVersion: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:23
status
status: "ready" | "closed" | "closing" | "initializing";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:18
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejections
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
EventEmitter.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
EventEmitter.defaultMaxListeners
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
EventEmitter.errorMonitor
minimumVersion
static minimumVersion: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:14
recommendedMinimumVersion
static recommendedMinimumVersion: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:15
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:40
Returns
Promise<RedisClient>
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:47
Returns
string
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
EventEmitter.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.addListener
close()
close(force?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:45
Parameters
| Parameter | Type |
|---|---|
force? | boolean |
Returns
Promise<void>
disconnect()
disconnect(wait?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:43
Parameters
| Parameter | Type |
|---|---|
wait? | boolean |
Returns
Promise<void>
emit()
emit<K>(eventName, ...args): boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:904
Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments
to each.
Returns true if the event had listeners, false otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
...args | AnyRest |
Returns
boolean
Since
v0.1.26
Inherited from
EventEmitter.emit
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
EventEmitter.eventNames
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
EventEmitter.listenerCount
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
EventEmitter.listeners
loadCommands()
protected loadCommands(packageVersion, providedScripts?): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:41
Parameters
| Parameter | Type |
|---|---|
packageVersion | string |
providedScripts? | Record<string, RawCommand> |
Returns
void
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
EventEmitter.off
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Inherited from
EventEmitter.on
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
EventEmitter.once
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependListener
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependOnceListener
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
EventEmitter.rawListeners
reconnect()
reconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:44
Returns
Promise<void>
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeAllListeners
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeListener
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
EventEmitter.setMaxListeners
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
EventEmitter.addAbortListener
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
EventEmitter.getEventListeners
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
EventEmitter.listenerCount
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
EventEmitter.on
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
EventEmitter.once
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
EventEmitter.setMaxListeners
waitUntilReady()
static waitUntilReady(client): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:39
Waits for a redis client to be ready.
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
Returns
Promise<void>
Repeat
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:6
Base class for all classes that need to interact with queues. This class is normally not used directly, but extended by the other classes.
Extends
Constructors
Constructor
new Repeat(
name,
opts,
Connection?): Repeat;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:9
Parameters
| Parameter | Type |
|---|---|
name | string |
opts | RepeatBaseOptions |
Connection? | typeof RedisConnection |
Returns
Overrides
Properties
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
Inherited from
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Inherited from
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
Inherited from
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
Inherited from
QueueBase.hasBlockingConnection
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Inherited from
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Inherited from
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:15
Inherited from
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Inherited from
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
Inherited from
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
QueueBase.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
Inherited from
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
QueueBase.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
Inherited from
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
Inherited from
QueueBase.checkConnectionError
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
Inherited from
close()
close(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:60
Closes the connection and returns a promise that resolves when the connection is closed.
Returns
Promise<void>
Inherited from
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
Inherited from
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
Inherited from
emit()
emit(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:52
Emits an event. Normally used by subclasses to emit events.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | symbol | The emitted event. |
...args | any[] | - |
Returns
boolean
Inherited from
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
getRepeatableCount()
getRepeatableCount(): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:20
Returns
Promise<number>
getRepeatableJobs()
getRepeatableJobs(
start?,
end?,
asc?): Promise<RepeatableJob[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:19
Parameters
| Parameter | Type |
|---|---|
start? | number |
end? | number |
asc? | boolean |
Returns
Promise<RepeatableJob[]>
getRepeatJobKey()
getRepeatJobKey<T, N>(
name,
nextMillis,
repeatJobKey,
data): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:14
Type Parameters
| Type Parameter |
|---|
T |
N extends string |
Parameters
| Parameter | Type |
|---|---|
name | N |
nextMillis | number |
repeatJobKey | string |
data | T |
Returns
string
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Inherited from
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
removeRepeatable()
removeRepeatable(
name,
repeat,
jobId?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:15
Parameters
| Parameter | Type |
|---|---|
name | string |
repeat | RepeatOptions |
jobId? | string |
Returns
Promise<number>
removeRepeatableByKey()
removeRepeatableByKey(repeatJobKey): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:16
Parameters
| Parameter | Type |
|---|---|
repeatJobKey | string |
Returns
Promise<number>
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Inherited from
updateRepeatableJob()
updateRepeatableJob<T, R, N>(
name,
data,
opts,
__namedParameters): Promise<Job<T, R, N> | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:10
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type |
|---|---|
name | N |
data | T |
opts | JobsOptions |
__namedParameters | { override: boolean; } |
__namedParameters.override | boolean |
Returns
Promise<Job<T, R, N> | undefined>
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:53
Returns
Promise<RedisClient>
Inherited from
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
Scripts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:8
Constructors
Constructor
new Scripts(queue): Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:12
Parameters
| Parameter | Type |
|---|---|
queue | ScriptQueueContext |
Returns
Properties
moveToFinishedKeys
moveToFinishedKeys: (string | undefined)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:11
queue
protected queue: ScriptQueueContext;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:9
version
protected version: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:10
Methods
addDelayedJob()
protected addDelayedJob(
client,
job,
encodedOpts,
args): Promise<string | number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:16
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
Promise<string | number>
addDelayedJobArgs()
protected addDelayedJobArgs(
job,
encodedOpts,
args): (string | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:15
Parameters
| Parameter | Type |
|---|---|
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
(string | Buffer<ArrayBufferLike>)[]
addJob()
addJob(
client,
job,
opts,
jobId,
parentKeyOpts?): Promise<string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:23
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
job | JobJson |
opts | RedisJobOptions |
jobId | string |
parentKeyOpts? | ParentKeyOpts |
Returns
Promise<string>
addJobScheduler()
addJobScheduler(
jobSchedulerId,
nextMillis,
templateData,
templateOpts,
opts,
delayedJobOpts,
producerId?): Promise<[string, number]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:29
Parameters
| Parameter | Type |
|---|---|
jobSchedulerId | string |
nextMillis | number |
templateData | string |
templateOpts | RedisJobOptions |
opts | RepeatableOptions |
delayedJobOpts | JobsOptions |
producerId? | string |
Returns
Promise<[string, number]>
addLog()
addLog(
jobId,
logRow,
keepLogs?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:43
Parameters
| Parameter | Type |
|---|---|
jobId | string |
logRow | string |
keepLogs? | number |
Returns
Promise<number>
addParentJob()
protected addParentJob(
client,
job,
encodedOpts,
args): Promise<string | number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:20
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
Promise<string | number>
addParentJobArgs()
protected addParentJobArgs(
job,
encodedOpts,
args): (string | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:19
Parameters
| Parameter | Type |
|---|---|
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
(string | Buffer<ArrayBufferLike>)[]
addPrioritizedJob()
protected addPrioritizedJob(
client,
job,
encodedOpts,
args): Promise<string | number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:18
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
Promise<string | number>
addPrioritizedJobArgs()
protected addPrioritizedJobArgs(
job,
encodedOpts,
args): (string | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:17
Parameters
| Parameter | Type |
|---|---|
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
(string | Buffer<ArrayBufferLike>)[]
addRepeatableJob()
addRepeatableJob(
customKey,
nextMillis,
opts,
legacyCustomKey): Promise<string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:27
Parameters
| Parameter | Type |
|---|---|
customKey | string |
nextMillis | number |
opts | RepeatableOptions |
legacyCustomKey | string |
Returns
Promise<string>
addRepeatableJobArgs()
protected addRepeatableJobArgs(
customKey,
nextMillis,
opts,
legacyCustomKey): (string | number | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:26
Parameters
| Parameter | Type |
|---|---|
customKey | string |
nextMillis | number |
opts | RepeatableOptions |
legacyCustomKey | string |
Returns
(string | number | Buffer<ArrayBufferLike>)[]
addStandardJob()
protected addStandardJob(
client,
job,
encodedOpts,
args): Promise<string | number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:22
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
Promise<string | number>
addStandardJobArgs()
protected addStandardJobArgs(
job,
encodedOpts,
args): (string | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:21
Parameters
| Parameter | Type |
|---|---|
job | JobJson |
encodedOpts | any |
args | (string | number | Record<string, any>)[] |
Returns
(string | Buffer<ArrayBufferLike>)[]
changeDelay()
changeDelay(jobId, delay): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:78
Change delay of a delayed job.
Reschedules a delayed job by setting a new delay from the current time. For example, calling changeDelay(5000) will reschedule the job to execute 5000 milliseconds (5 seconds) from now, regardless of the original delay.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | the ID of the job to change the delay for. |
delay | number | milliseconds from now when the job should be processed. |
Returns
Promise<void>
delay in milliseconds.
Throws
JobNotExist This exception is thrown if jobId is missing.
Throws
JobNotInState This exception is thrown if job is not in delayed state.
changePriority()
changePriority(
jobId,
priority?,
lifo?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:80
Parameters
| Parameter | Type |
|---|---|
jobId | string |
priority? | number |
lifo? | boolean |
Returns
Promise<void>
changePriorityArgs()
protected changePriorityArgs(
jobId,
priority?,
lifo?): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:81
Parameters
| Parameter | Type |
|---|---|
jobId | string |
priority? | number |
lifo? | boolean |
Returns
(string | number)[]
cleanJobsInSet()
cleanJobsInSet(
set,
timestamp,
limit?): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:106
Remove jobs in a specific state.
Parameters
| Parameter | Type |
|---|---|
set | string |
timestamp | number |
limit? | number |
Returns
Promise<string[]>
Id jobs from the deleted records.
drain()
drain(delayed): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:48
Parameters
| Parameter | Type |
|---|---|
delayed | boolean |
Returns
Promise<void>
execCommand()
execCommand(
client,
commandName,
args): any;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:13
Parameters
| Parameter | Type |
|---|---|
client | RedisClient | ChainableCommander |
commandName | string |
args | any[] |
Returns
any
extendLock()
extendLock(
jobId,
token,
duration,
client?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:39
Parameters
| Parameter | Type |
|---|---|
jobId | string |
token | string |
duration | number |
client? | RedisClient | ChainableCommander |
Returns
Promise<number>
extendLocks()
extendLocks(
jobIds,
tokens,
duration): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:40
Parameters
| Parameter | Type |
|---|---|
jobIds | string[] |
tokens | string[] |
duration | number |
Returns
Promise<string[]>
finishedErrors()
finishedErrors(__namedParameters): Error;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:175
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { code: number; command: string; jobId?: string; parentKey?: string; state?: string; } |
__namedParameters.code | number |
__namedParameters.command | string |
__namedParameters.jobId? | string |
__namedParameters.parentKey? | string |
__namedParameters.state? | string |
Returns
Error
getCounts()
getCounts(types): Promise<number[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:54
Parameters
| Parameter | Type |
|---|---|
types | JobType[] |
Returns
Promise<number[]>
getCountsPerPriority()
getCountsPerPriority(priorities): Promise<number[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:56
Parameters
| Parameter | Type |
|---|---|
priorities | number[] |
Returns
Promise<number[]>
getCountsPerPriorityArgs()
protected getCountsPerPriorityArgs(priorities): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:55
Parameters
| Parameter | Type |
|---|---|
priorities | number[] |
Returns
(string | number)[]
getDependencyCounts()
getDependencyCounts(jobId, types): Promise<number[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:58
Parameters
| Parameter | Type |
|---|---|
jobId | string |
types | string[] |
Returns
Promise<number[]>
getDependencyCountsArgs()
protected getDependencyCountsArgs(jobId, types): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:57
Parameters
| Parameter | Type |
|---|---|
jobId | string |
types | string[] |
Returns
(string | number)[]
getJobScheduler()
getJobScheduler(id): Promise<[any, string | null]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:108
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<[any, string | null]>
getJobSchedulerArgs()
getJobSchedulerArgs(id): string[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:107
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
string[]
getKeepJobs()
protected getKeepJobs(shouldRemove, workerKeepJobs): KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:45
Parameters
| Parameter | Type |
|---|---|
shouldRemove | number | boolean | KeepJobs | undefined |
workerKeepJobs | KeepJobs | undefined |
Returns
getMetrics()
getMetrics(
type,
start?,
end?): Promise<[string[], string[], number]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:128
Parameters
| Parameter | Type |
|---|---|
type | "completed" | "failed" |
start? | number |
end? | number |
Returns
Promise<[string[], string[], number]>
getRanges()
getRanges(
types,
start?,
end?,
asc?): Promise<[string][]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:52
Parameters
| Parameter | Type |
|---|---|
types | JobType[] |
start? | number |
end? | number |
asc? | boolean |
Returns
Promise<[string][]>
getRateLimitTtl()
getRateLimitTtl(maxJobs?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:100
Parameters
| Parameter | Type |
|---|---|
maxJobs? | number |
Returns
Promise<number>
getRateLimitTtlArgs()
getRateLimitTtlArgs(maxJobs?): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:99
Parameters
| Parameter | Type |
|---|---|
maxJobs? | number |
Returns
(string | number)[]
getRepeatConcatOptions()
getRepeatConcatOptions(repeatConcatOptions, repeatJobKey): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:33
Parameters
| Parameter | Type |
|---|---|
repeatConcatOptions | string |
repeatJobKey | string |
Returns
string
getState()
getState(jobId): Promise<JobState | "unknown">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:62
Parameters
| Parameter | Type |
|---|---|
jobId | string |
Returns
Promise<JobState | "unknown">
isFinished()
isFinished(jobId, returnValue?): Promise<number | [number, string]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:61
Parameters
| Parameter | Type |
|---|---|
jobId | string |
returnValue? | boolean |
Returns
Promise<number | [number, string]>
isJobInList()
isJobInList(listKey, jobId): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:14
Parameters
| Parameter | Type |
|---|---|
listKey | string |
jobId | string |
Returns
Promise<boolean>
isMaxed()
isMaxed(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:85
Returns
Promise<boolean>
isMaxedArgs()
isMaxedArgs(): string[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:84
Returns
string[]
moveJobFromActiveToWait()
moveJobFromActiveToWait(jobId, token?): Promise<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:151
Moves a job back from Active to Wait. This script is used when a job has been manually rate limited and needs to be moved back to wait from active status.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | Job id |
token? | string | - |
Returns
Promise<any>
moveJobsToWaitArgs()
protected moveJobsToWaitArgs(
state,
count,
timestamp): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:111
Parameters
| Parameter | Type |
|---|---|
state | FinishedStatus | "delayed" |
count | number |
timestamp | number |
Returns
(string | number)[]
moveStalledJobsToWait()
moveStalledJobsToWait(): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:141
Looks for unlocked jobs in the active queue.
The job was being worked on, but the worker process died and it failed to renew the lock. We call these jobs 'stalled'. This is the most common case. We resolve these by moving them back to wait to be re-processed. To prevent jobs from cycling endlessly between active and wait, (e.g. if the job handler keeps crashing), we limit the number stalled job recoveries to settings.maxStalledCount.
Returns
Promise<string[]>
moveStalledJobsToWaitArgs()
protected moveStalledJobsToWaitArgs(): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:131
Returns
(string | number)[]
moveToActive()
moveToActive(
client,
token,
name?): Promise<any[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:129
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
token | string |
name? | string |
Returns
Promise<any[]>
moveToCompletedArgs()
moveToCompletedArgs<T, R, N>(
job,
returnvalue,
removeOnComplete,
token,
fetchNext?): (string | number | boolean | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:59
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type |
|---|---|
job | MinimalJob<T, R, N> |
returnvalue | R |
removeOnComplete | number | boolean | KeepJobs |
token | string |
fetchNext? | boolean |
Returns
(string | number | boolean | Buffer<ArrayBufferLike>)[]
moveToDelayed()
moveToDelayed(
jobId,
timestamp,
delay,
token?,
opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:86
Parameters
| Parameter | Type |
|---|---|
jobId | string |
timestamp | number |
delay | number |
token? | string |
opts? | MoveToDelayedOpts |
Returns
Promise<void>
moveToDelayedArgs()
moveToDelayedArgs(
jobId,
timestamp,
token,
delay,
opts?): (string | number | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:82
Parameters
| Parameter | Type |
|---|---|
jobId | string |
timestamp | number |
token | string |
delay | number |
opts? | MoveToDelayedOpts |
Returns
(string | number | Buffer<ArrayBufferLike>)[]
moveToFailedArgs()
moveToFailedArgs<T, R, N>(
job,
failedReason,
removeOnFailed,
token,
fetchNext?,
fieldsToUpdate?): (string | number | boolean | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:60
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type |
|---|---|
job | MinimalJob<T, R, N> |
failedReason | string |
removeOnFailed | number | boolean | KeepJobs |
token | string |
fetchNext? | boolean |
fieldsToUpdate? | Record<string, any> |
Returns
(string | number | boolean | Buffer<ArrayBufferLike>)[]
moveToFinished()
moveToFinished(jobId, args): Promise<any[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:46
Parameters
| Parameter | Type |
|---|---|
jobId | string |
args | (string | number | boolean | Buffer<ArrayBufferLike>)[] |
Returns
Promise<any[]>
moveToFinishedArgs()
protected moveToFinishedArgs<T, R, N>(
job,
val,
propVal,
shouldRemove,
target,
token,
timestamp,
fetchNext?,
fieldsToUpdate?): (string | number | boolean | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:44
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type |
|---|---|
job | MinimalJob<T, R, N> |
val | any |
propVal | FinishedPropValAttribute |
shouldRemove | number | boolean | KeepJobs | undefined |
target | FinishedStatus |
token | string |
timestamp | number |
fetchNext? | boolean |
fieldsToUpdate? | Record<string, any> |
Returns
(string | number | boolean | Buffer<ArrayBufferLike>)[]
moveToWaitingChildren()
moveToWaitingChildren(
jobId,
token,
opts?): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:98
Move parent job to waiting-children state.
Parameters
| Parameter | Type |
|---|---|
jobId | string |
token | string |
opts? | MoveToWaitingChildrenOpts |
Returns
Promise<boolean>
true if job is successfully moved, false if there are pending dependencies.
Throws
JobNotExist This exception is thrown if jobId is missing.
Throws
JobLockNotExist This exception is thrown if job lock is missing.
Throws
JobNotInState This exception is thrown if job is not in active state.
moveToWaitingChildrenArgs()
moveToWaitingChildrenArgs(
jobId,
token,
opts?): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:83
Parameters
| Parameter | Type |
|---|---|
jobId | string |
token | string |
opts? | MoveToWaitingChildrenOpts |
Returns
(string | number)[]
obliterate()
obliterate(opts): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:152
Parameters
| Parameter | Type |
|---|---|
opts | { count: number; force: boolean; } |
opts.count | number |
opts.force | boolean |
Returns
Promise<number>
paginate()
paginate(key, opts): Promise<{
cursor: string;
items: {
err?: string;
id: string;
v?: any;
}[];
jobs?: JobJsonRaw[];
total: number;
}>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:161
Paginate a set or hash keys.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | - |
opts | { end: number; fetchJobs?: boolean; start: number; } | options to define the pagination behaviour |
opts.end | number | - |
opts.fetchJobs? | boolean | - |
opts.start | number | - |
Returns
Promise<{
cursor: string;
items: {
err?: string;
id: string;
v?: any;
}[];
jobs?: JobJsonRaw[];
total: number;
}>
pause()
pause(pause): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:25
Parameters
| Parameter | Type |
|---|---|
pause | boolean |
Returns
Promise<void>
pauseArgs()
protected pauseArgs(pause): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:24
Parameters
| Parameter | Type |
|---|---|
pause | boolean |
Returns
(string | number)[]
promote()
promote(jobId): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:130
Parameters
| Parameter | Type |
|---|---|
jobId | string |
Returns
Promise<void>
promoteJobs()
promoteJobs(count?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:113
Parameters
| Parameter | Type |
|---|---|
count? | number |
Returns
Promise<number>
remove()
remove(jobId, removeChildren): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:37
Parameters
| Parameter | Type |
|---|---|
jobId | string |
removeChildren | boolean |
Returns
Promise<number>
removeArgs()
protected removeArgs(jobId, removeChildren): (string | number)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:36
Parameters
| Parameter | Type |
|---|---|
jobId | string |
removeChildren | boolean |
Returns
(string | number)[]
removeChildDependency()
removeChildDependency(jobId, parentKey): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:50
Parameters
| Parameter | Type |
|---|---|
jobId | string |
parentKey | string |
Returns
Promise<boolean>
removeDeduplicationKey()
removeDeduplicationKey(deduplicationId, jobId): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:28
Parameters
| Parameter | Type |
|---|---|
deduplicationId | string |
jobId | string |
Returns
Promise<number>
removeJobScheduler()
removeJobScheduler(jobSchedulerId): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:35
Parameters
| Parameter | Type |
|---|---|
jobSchedulerId | string |
Returns
Promise<number>
removeRepeatable()
removeRepeatable(
legacyRepeatJobId,
repeatConcatOptions,
repeatJobKey): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:34
Parameters
| Parameter | Type |
|---|---|
legacyRepeatJobId | string |
repeatConcatOptions | string |
repeatJobKey | string |
Returns
Promise<number>
removeUnprocessedChildren()
removeUnprocessedChildren(jobId): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:38
Parameters
| Parameter | Type |
|---|---|
jobId | string |
Returns
Promise<void>
reprocessJob()
reprocessJob<T, R, N>(
job,
state,
opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:127
Attempts to reprocess a job
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
job | MinimalJob<T, R, N> | The job to reprocess |
state | "completed" | "failed" | The expected job state. If the job is not found on the provided state, then it's not reprocessed. Supported states: 'failed', 'completed' |
opts? | RetryOptions | - |
Returns
Promise<void>
A promise that resolves when the job has been successfully moved to the wait queue.
Throws
Will throw an error with a code property indicating the failure reason:
- code 0: Job does not exist
- code -1: Job is currently locked and can't be retried
- code -2: Job was not found in the expected set
retryJob()
retryJob(
jobId,
lifo,
token?,
opts?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:110
Parameters
| Parameter | Type |
|---|---|
jobId | string |
lifo | boolean |
token? | string |
opts? | RetryJobOpts |
Returns
Promise<void>
retryJobArgs()
retryJobArgs(
jobId,
lifo,
token,
opts?): (string | number | Buffer<ArrayBufferLike>)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:109
Parameters
| Parameter | Type |
|---|---|
jobId | string |
lifo | boolean |
token | string |
opts? | MoveToDelayedOpts |
Returns
(string | number | Buffer<ArrayBufferLike>)[]
retryJobs()
retryJobs(
state?,
count?,
timestamp?): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:112
Parameters
| Parameter | Type |
|---|---|
state? | FinishedStatus |
count? | number |
timestamp? | number |
Returns
Promise<number>
updateData()
updateData<T, R, N>(job, data): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:41
Type Parameters
| Type Parameter |
|---|
T |
R |
N extends string |
Parameters
| Parameter | Type |
|---|---|
job | MinimalJob<T, R, N> |
data | T |
Returns
Promise<void>
updateJobSchedulerNextMillis()
updateJobSchedulerNextMillis(
jobSchedulerId,
nextMillis,
templateData,
delayedJobOpts,
producerId?): Promise<string | null>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:31
Parameters
| Parameter | Type |
|---|---|
jobSchedulerId | string |
nextMillis | number |
templateData | string |
delayedJobOpts | JobsOptions |
producerId? | string |
Returns
Promise<string | null>
updateProgress()
updateProgress(jobId, progress): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:42
Parameters
| Parameter | Type |
|---|---|
jobId | string |
progress | JobProgress |
Returns
Promise<void>
updateRepeatableJobMillis()
updateRepeatableJobMillis(
client,
customKey,
nextMillis,
legacyCustomKey): Promise<string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:30
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
customKey | string |
nextMillis | number |
legacyCustomKey | string |
Returns
Promise<string>
UnrecoverableError
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/unrecoverable-error.d.ts:9
UnrecoverableError
Error to move a job to failed even if the attemptsMade are lower than the expected limit.
Extends
Error
Constructors
Constructor
new UnrecoverableError(message?): UnrecoverableError;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/unrecoverable-error.d.ts:10
Parameters
| Parameter | Type |
|---|---|
message? | string |
Returns
Overrides
Error.constructor
Properties
message
message: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.message
name
name: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.name
stack?
optional stack: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
WaitingChildrenError
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/waiting-children-error.d.ts:9
WaitingChildrenError
Error to be thrown when job is moved to waiting-children state from job in active state.
Extends
Error
Constructors
Constructor
new WaitingChildrenError(message?): WaitingChildrenError;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/waiting-children-error.d.ts:10
Parameters
| Parameter | Type |
|---|---|
message? | string |
Returns
Overrides
Error.constructor
Properties
message
message: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.message
name
name: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.name
stack?
optional stack: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
WaitingError
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/waiting-error.d.ts:8
WaitingError
Error to be thrown when job is moved to wait or prioritized state from job in active state.
Extends
Error
Constructors
Constructor
new WaitingError(message?): WaitingError;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/waiting-error.d.ts:9
Parameters
| Parameter | Type |
|---|---|
message? | string |
Returns
Overrides
Error.constructor
Properties
message
message: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.message
name
name: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.name
stack?
optional stack: string;
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
Worker
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:116
This class represents a worker that is able to process jobs from the queue. As soon as the class is instantiated and a connection to Redis is established it will start processing jobs.
Extends
Type Parameters
| Type Parameter |
|---|
DataType |
ResultType |
NameType extends string |
Constructors
Constructor
new Worker<DataType, ResultType, NameType>(
name,
processor?,
opts?,
Connection?): Worker<DataType, ResultType, NameType>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:137
Parameters
| Parameter | Type |
|---|---|
name | string |
processor? | string | URL | Processor<DataType, ResultType, NameType> | null |
opts? | WorkerOptions |
Connection? | typeof RedisConnection |
Returns
Worker<DataType, ResultType, NameType>
Overrides
Properties
_jobScheduler
protected _jobScheduler: JobScheduler;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:131
closed
protected closed: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:19
Inherited from
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:18
Inherited from
connection
protected connection: RedisConnection;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:22
Inherited from
hasBlockingConnection
protected hasBlockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:20
Inherited from
QueueBase.hasBlockingConnection
id
readonly id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:118
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:17
Inherited from
lockManager
protected lockManager: LockManager;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:126
mainLoopRunning
protected mainLoopRunning: Promise<void> | null;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:135
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:14
Inherited from
opts
readonly opts: WorkerOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:117
Overrides
paused
protected paused: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:132
processFn
protected processFn: Processor<DataType, ResultType, NameType>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:133
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:23
Inherited from
running
protected running: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:134
scripts
protected scripts: Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:21
Inherited from
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:16
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
captureRejections
static captureRejections: boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:425
Value: boolean
Change the default captureRejections option on all new EventEmitter objects.
Since
v13.4.0, v12.16.0
Inherited from
captureRejectionSymbol
readonly static captureRejectionSymbol: typeof captureRejectionSymbol;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:418
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler.
Since
v13.4.0, v12.16.0
Inherited from
QueueBase.captureRejectionSymbol
defaultMaxListeners
static defaultMaxListeners: number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:464
By default, a maximum of 10 listeners can be registered for any single
event. This limit can be changed for individual EventEmitter instances
using the emitter.setMaxListeners(n) method. To change the default
for allEventEmitter instances, the events.defaultMaxListeners property
can be used. If this value is not a positive number, a RangeError is thrown.
Take caution when setting the events.defaultMaxListeners because the
change affects all EventEmitter instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n) still has
precedence over events.defaultMaxListeners.
This is not a hard limit. The EventEmitter instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any single
EventEmitter, the emitter.getMaxListeners() and emitter.setMaxListeners() methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning') and will
have the additional emitter, type, and count properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name property is set to 'MaxListenersExceededWarning'.
Since
v0.11.2
Inherited from
errorMonitor
readonly static errorMonitor: typeof errorMonitor;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:411
This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.
Installing a listener using this symbol does not change the behavior once an 'error' event is emitted. Therefore, the process will still crash if no
regular 'error' listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:35
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
concurrency
Get Signature
get concurrency(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:185
Returns
number
Set Signature
set concurrency(concurrency): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:184
Parameters
| Parameter | Type |
|---|---|
concurrency | number |
Returns
void
Job
Get Signature
get protected Job(): typeof Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:44
Helper to easily extend Job class calls.
Returns
typeof Job
Inherited from
jobScheduler
Get Signature
get jobScheduler(): Promise<JobScheduler>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:187
Returns
Promise<JobScheduler>
minimumBlockTimeout
Get Signature
get minimumBlockTimeout(): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:209
Returns
number
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:40
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
repeat
Get Signature
get repeat(): Promise<Repeat>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:186
Returns
Promise<Repeat>
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
QueueBase.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
base64Name()
protected base64Name(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:54
Returns
string
Inherited from
callProcessJob()
protected callProcessJob(
job,
token,
signal?): Promise<ResultType>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:159
Parameters
| Parameter | Type |
|---|---|
job | Job<DataType, ResultType, NameType> |
token | string |
signal? | AbortSignal |
Returns
Promise<ResultType>
cancelAllJobs()
cancelAllJobs(reason?): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:183
Cancels all jobs currently being processed by this worker. All active job processor functions will receive abort signals.
Parameters
| Parameter | Type | Description |
|---|---|---|
reason? | string | Optional reason for the cancellation |
Returns
void
cancelJob()
cancelJob(jobId, reason?): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:176
Cancels a specific job currently being processed by this worker. The job's processor function will receive an abort signal.
Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | The ID of the job to cancel |
reason? | string | Optional reason for the cancellation |
Returns
boolean
true if the job was found and cancelled, false otherwise
checkConnectionError()
protected checkConnectionError<T>(fn, delayInMs?): Promise<T | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:66
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
delayInMs? | number |
Returns
Promise<T | undefined>
Inherited from
QueueBase.checkConnectionError
clientName()
protected clientName(suffix?): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:55
Parameters
| Parameter | Type |
|---|---|
suffix? | string |
Returns
string
Inherited from
close()
close(force?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:262
Closes the worker and related redis connections.
This method waits for current jobs to finalize before returning.
Parameters
| Parameter | Type | Description |
|---|---|---|
force? | boolean | Use force boolean parameter if you do not want to wait for current jobs to be processed. When using telemetry, be mindful that it can interfere with the proper closure of spans, potentially preventing them from being exported. |
Returns
Promise<void>
Promise that resolves when the worker has been closed.
Overrides
createJob()
protected createJob(data, jobId): Job<DataType, ResultType, NameType>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:160
Parameters
| Parameter | Type |
|---|---|
data | JobJsonRaw |
jobId | string |
Returns
Job<DataType, ResultType, NameType>
createLockManager()
protected createLockManager(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:142
Creates and configures the lock manager for processing jobs. This method can be overridden in subclasses to customize lock manager behavior.
Returns
void
createSandbox()
protected createSandbox(processor): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:149
Creates and configures the sandbox for processing jobs. This method can be overridden in subclasses to customize sandbox behavior.
Parameters
| Parameter | Type | Description |
|---|---|---|
processor | string | URL | Processor<DataType, ResultType, NameType> | null | The processor file path, URL, or function to be sandboxed |
Returns
void
createScripts()
protected createScripts(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:36
Returns
void
Inherited from
delay()
delay(milliseconds?, abortController?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:219
This function is exposed only for testing purposes.
Parameters
| Parameter | Type |
|---|---|
milliseconds? | number |
abortController? | AbortController |
Returns
Promise<void>
disconnect()
disconnect(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:65
Force disconnects a connection.
Returns
Promise<void>
Inherited from
emit()
emit<U>(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:155
Emits an event. Normally used by subclasses to emit events.
Type Parameters
| Type Parameter |
|---|
U extends keyof WorkerListener<DataType, ResultType, NameType> |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The emitted event. |
...args | Parameters<WorkerListener<DataType, ResultType, NameType>[U]> | - |
Returns
boolean
Overrides
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
extendJobLocks()
extendJobLocks(
jobIds,
tokens,
duration): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:154
Public accessor method for LockManager to extend locks. This delegates to the protected scripts object.
Parameters
| Parameter | Type |
|---|---|
jobIds | string[] |
tokens | string[] |
duration | number |
Returns
Promise<string[]>
getBlockTimeout()
protected getBlockTimeout(blockUntil): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:213
Parameters
| Parameter | Type |
|---|---|
blockUntil | number |
Returns
number
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
getNextJob()
getNextJob(token, __namedParameters?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:201
Returns a promise that resolves to the next job in queue.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | worker token to be assigned to retrieved job |
__namedParameters? | GetNextJobOptions | - |
Returns
Promise<Job<DataType, ResultType, NameType>>
a Job or undefined if no job was available in the queue.
getRateLimitDelay()
protected getRateLimitDelay(delay): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:214
Parameters
| Parameter | Type |
|---|---|
delay | number |
Returns
number
handleCompleted()
protected handleCompleted(
result,
job,
token,
fetchNextCallback?,
span?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:224
Parameters
| Parameter | Type |
|---|---|
result | ResultType |
job | Job<DataType, ResultType, NameType> |
token | string |
fetchNextCallback? | () => boolean |
span? | Span<any> |
Returns
Promise<Job<DataType, ResultType, NameType>>
handleFailed()
protected handleFailed(
err,
job,
token,
fetchNextCallback?,
span?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:225
Parameters
| Parameter | Type |
|---|---|
err | Error |
job | Job<DataType, ResultType, NameType> |
token | string |
fetchNextCallback? | () => boolean |
span? | Span<any> |
Returns
Promise<Job<DataType, ResultType, NameType>>
isPaused()
isPaused(): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:242
Checks if worker is paused.
Returns
boolean
true if worker is paused, false otherwise.
isRunning()
isRunning(): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:249
Checks if worker is currently running.
Returns
boolean
true if worker is running, false otherwise.
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
moveToActive()
protected moveToActive(
client,
token,
name?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:211
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
token | string |
name? | string |
Returns
Promise<Job<DataType, ResultType, NameType>>
nextJobFromJobData()
protected nextJobFromJobData(
jobData?,
jobId?,
token?): Promise<Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:221
Parameters
| Parameter | Type |
|---|---|
jobData? | JobJsonRaw |
jobId? | string |
token? | string |
Returns
Promise<Job<DataType, ResultType, NameType>>
off()
off<U>(eventName, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:156
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
U extends keyof WorkerListener<DataType, ResultType, NameType> |
Parameters
| Parameter | Type |
|---|---|
eventName | U |
listener | WorkerListener<DataType, ResultType, NameType>[U] |
Returns
this
Since
v10.0.0
Overrides
on()
on<U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:157
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
U extends keyof WorkerListener<DataType, ResultType, NameType> |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The name of the event. |
listener | WorkerListener<DataType, ResultType, NameType>[U] | The callback function |
Returns
this
Since
v0.1.101
Overrides
once()
once<U>(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:158
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
U extends keyof WorkerListener<DataType, ResultType, NameType> |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | U | The name of the event. |
listener | WorkerListener<DataType, ResultType, NameType>[U] | The callback function |
Returns
this
Since
v0.3.0
Overrides
pause()
pause(doNotWaitActive?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:230
Pauses the processing of this queue only for this worker.
Parameters
| Parameter | Type |
|---|---|
doNotWaitActive? | boolean |
Returns
Promise<void>
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
processJob()
processJob(
job,
token,
fetchNextCallback?): Promise<void | Job<DataType, ResultType, NameType>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:222
Parameters
| Parameter | Type |
|---|---|
job | Job<DataType, ResultType, NameType> |
token | string |
fetchNextCallback? | () => boolean |
Returns
Promise<void | Job<DataType, ResultType, NameType>>
rateLimit()
rateLimit(expireTimeMs): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:208
Overrides the rate limit to be active for the next jobs.
Parameters
| Parameter | Type | Description |
|---|---|---|
expireTimeMs | number | expire time in ms of this rate limit. |
Returns
Promise<void>
Deprecated
This method is deprecated and will be removed in v6. Use queue.rateLimit method instead.
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
resume()
resume(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:235
Resumes processing of this worker (if paused).
Returns
void
run()
run(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:188
Returns
Promise<void>
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
startStalledCheckTimer()
startStalledCheckTimer(): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:275
Manually starts the stalled checker. The check will run once as soon as this method is called, and then every opts.stalledInterval milliseconds until the worker is closed. Note: Normally you do not need to call this method, since the stalled checker is automatically started when the worker starts processing jobs after calling run. However if you want to process the jobs manually you need to call this method to start the stalled checker.
Returns
Promise<void>
See
https://docs.bullmq.io/patterns/manually-fetching-jobs
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-base.d.ts:77
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
Inherited from
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:167
Waits until the worker is ready to start processing jobs. In general only useful when writing tests.
Returns
Promise<RedisClient>
Overrides
addAbortListener()
static addAbortListener(signal, resource): Disposable;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:403
Listens once to the abort event on the provided signal.
Listening to the abort event on abort signals is unsafe and may
lead to resource leaks since another third party with the signal can
call e.stopImmediatePropagation(). Unfortunately Node.js cannot change
this since it would violate the web standard. Additionally, the original
API makes it easy to forget to remove listeners.
This API allows safely using AbortSignals in Node.js APIs by solving these
two issues by listening to the event such that stopImmediatePropagation does
not prevent the listener from running.
Returns a disposable so that it may be unsubscribed from more easily.
import { addAbortListener } from 'node:events';
function example(signal) {
let disposable;
try {
signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
disposable = addAbortListener(signal, (e) => {
// Do something when signal is aborted.
});
} finally {
disposable?.[Symbol.dispose]();
}
}
Parameters
| Parameter | Type |
|---|---|
signal | AbortSignal |
resource | (event) => void |
Returns
Disposable
Disposable that removes the abort listener.
Since
v20.5.0
Inherited from
getEventListeners()
static getEventListeners(emitter, name): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:325
Returns a copy of the array of listeners for the event named eventName.
For EventEmitters this behaves exactly the same as calling .listeners on
the emitter.
For EventTargets this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.
import { getEventListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
name | string | symbol |
Returns
Function[]
Since
v15.2.0, v14.17.0
Inherited from
getMaxListeners()
static getMaxListeners(emitter): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:354
Returns the currently set max amount of listeners.
For EventEmitters this behaves exactly the same as calling .getMaxListeners on
the emitter.
For EventTargets this is the only way to get the max event listeners for the
event target. If the number of event handlers on a single EventTarget exceeds
the max set, the EventTarget will print a warning.
import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
{
const ee = new EventEmitter();
console.log(getMaxListeners(ee)); // 10
setMaxListeners(11, ee);
console.log(getMaxListeners(ee)); // 11
}
{
const et = new EventTarget();
console.log(getMaxListeners(et)); // 10
setMaxListeners(11, et);
console.log(getMaxListeners(et)); // 11
}
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter<DefaultEventMap> | EventTarget |
Returns
number
Since
v19.9.0
Inherited from
listenerCount()
static listenerCount(emitter, eventName): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:297
A class method that returns the number of listeners for the given eventName registered on the given emitter.
import { EventEmitter, listenerCount } from 'node:events';
const myEmitter = new EventEmitter();
myEmitter.on('event', () => {});
myEmitter.on('event', () => {});
console.log(listenerCount(myEmitter, 'event'));
// Prints: 2
Parameters
| Parameter | Type | Description |
|---|---|---|
emitter | EventEmitter | The emitter to query |
eventName | string | symbol | The event name |
Returns
number
Since
v0.9.12
Deprecated
Since v3.2.0 - Use listenerCount instead.
Inherited from
on()
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:270
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
Call Signature
static on(
emitter,
eventName,
options?): AsyncIterator<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:275
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
Returns an AsyncIterator that iterates eventName events. It will throw
if the EventEmitter emits 'error'. It removes all listeners when
exiting the loop. The value returned by each iteration is an array
composed of the emitted event arguments.
An AbortSignal can be used to cancel waiting on events:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ac = new AbortController();
(async () => {
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
for await (const event of on(ee, 'foo', { signal: ac.signal })) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
process.nextTick(() => ac.abort());
Use the close option to specify an array of event names that will end the iteration:
import { on, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
ee.emit('close');
});
for await (const event of on(ee, 'foo', { close: ['close'] })) {
console.log(event); // prints ['bar'] [42]
}
// the loop will exit after 'close' is emitted
console.log('done'); // prints 'done'
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterIteratorOptions |
Returns
AsyncIterator<any[]>
An AsyncIterator that iterates eventName events emitted by the emitter
Since
v13.6.0, v12.16.0
Inherited from
once()
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:184
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
eventName | string | symbol |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
Call Signature
static once(
emitter,
eventName,
options?): Promise<any[]>;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:189
Creates a Promise that is fulfilled when the EventEmitter emits the given
event or that is rejected if the EventEmitter emits 'error' while waiting.
The Promise will resolve with an array of all the arguments emitted to the
given event.
This method is intentionally generic and works with the web platform EventTarget interface, which has no special'error' event
semantics and does not listen to the 'error' event.
import { once, EventEmitter } from 'node:events';
import process from 'node:process';
const ee = new EventEmitter();
process.nextTick(() => {
ee.emit('myevent', 42);
});
const [value] = await once(ee, 'myevent');
console.log(value);
const err = new Error('kaboom');
process.nextTick(() => {
ee.emit('error', err);
});
try {
await once(ee, 'myevent');
} catch (err) {
console.error('error happened', err);
}
The special handling of the 'error' event is only used when events.once() is used to wait for another event. If events.once() is used to wait for the
'error' event itself, then it is treated as any other kind of event without
special handling:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
once(ee, 'error')
.then(([err]) => console.log('ok', err.message))
.catch((err) => console.error('error', err.message));
ee.emit('error', new Error('boom'));
// Prints: ok boom
An AbortSignal can be used to cancel waiting for the event:
import { EventEmitter, once } from 'node:events';
const ee = new EventEmitter();
const ac = new AbortController();
async function foo(emitter, event, signal) {
try {
await once(emitter, event, { signal });
console.log('event emitted!');
} catch (error) {
if (error.name === 'AbortError') {
console.error('Waiting for the event was canceled!');
} else {
console.error('There was an error', error.message);
}
}
}
foo(ee, 'foo', ac.signal);
ac.abort(); // Abort waiting for the event
ee.emit('foo'); // Prints: Waiting for the event was canceled!
Parameters
| Parameter | Type |
|---|---|
emitter | EventTarget |
eventName | string |
options? | StaticEventEmitterOptions |
Returns
Promise<any[]>
Since
v11.13.0, v10.16.0
Inherited from
RateLimitError()
static RateLimitError(): Error;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:136
Returns
Error
setMaxListeners()
static setMaxListeners(n?, ...eventTargets?): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:369
import { setMaxListeners, EventEmitter } from 'node:events';
const target = new EventTarget();
const emitter = new EventEmitter();
setMaxListeners(5, target, emitter);
Parameters
| Parameter | Type | Description |
|---|---|---|
n? | number | A non-negative number. The maximum number of listeners per EventTarget event. |
...eventTargets? | (EventEmitter<DefaultEventMap> | EventTarget)[] | Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, n is set as the default max for all newly created {EventTarget} and {EventEmitter} objects. |
Returns
void
Since
v15.4.0
Inherited from
abstract WorkerHost
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/hosts/worker-host.class.d.ts:2
Type Parameters
| Type Parameter |
|---|
T extends Worker |
Constructors
Constructor
new WorkerHost<T>(): WorkerHost<T>;
Returns
WorkerHost<T>
Accessors
worker
Get Signature
get worker(): T;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/hosts/worker-host.class.d.ts:4
Returns
T
Methods
process()
abstract process(job, token?): Promise<any>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/hosts/worker-host.class.d.ts:5
Parameters
| Parameter | Type |
|---|---|
job | Job |
token? | string |
Returns
Promise<any>
Interfaces
AddChildrenOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:19
Properties
multi
multi: ChainableCommander;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:20
nodes
nodes: FlowJob[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:21
parent
parent: {
parentDependenciesKey: string;
parentOpts: ParentOptions;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:22
parentDependenciesKey
parentDependenciesKey: string;
parentOpts
parentOpts: ParentOptions;
queuesOpts?
optional queuesOpts: FlowQueuesOpts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:26
AddNodeOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:7
Properties
multi
multi: ChainableCommander;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:8
node
node: FlowJob;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:9
parent?
optional parent: {
parentDependenciesKey: string;
parentOpts: ParentOptions;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:10
parentDependenciesKey
parentDependenciesKey: string;
parentOpts
parentOpts: ParentOptions;
queuesOpts?
optional queuesOpts: FlowQueuesOpts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:17
Queues options that will be applied in each node depending on queue name presence.
AdvancedOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts:14
Extends
Properties
backoffStrategy?
optional backoffStrategy: BackoffStrategy;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts:18
A custom backoff strategy.
repeatKeyHashAlgorithm?
optional repeatKeyHashAlgorithm: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts:12
A hash algorithm to be used when trying to create the job redis key. Default - md5
Inherited from
AdvancedRepeatOptions.repeatKeyHashAlgorithm
repeatStrategy?
optional repeatStrategy: RepeatStrategy;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts:7
A custom cron strategy.
Inherited from
AdvancedRepeatOptions.repeatStrategy
AdvancedRepeatOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts:3
Extended by
Properties
repeatKeyHashAlgorithm?
optional repeatKeyHashAlgorithm: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts:12
A hash algorithm to be used when trying to create the job redis key. Default - md5
repeatStrategy?
optional repeatStrategy: RepeatStrategy;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts:7
A custom cron strategy.
Attributes
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:127
Indexable
[attribute: string]: AttributeValue | undefined
BackoffOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/backoff-options.d.ts:6
Settings for backing off failed jobs.
See
https://docs.bullmq.io/guide/retrying-failing-jobs
Properties
delay?
optional delay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/backoff-options.d.ts:14
Delay in milliseconds.
jitter?
optional jitter: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/backoff-options.d.ts:19
Percentage of jitter usage.
Default Value
0
type
type:
| "fixed"
| "exponential"
| string & {
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/backoff-options.d.ts:10
Name of the backoff strategy.
BaseJobOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:69
Extends
Properties
attempts?
optional attempts: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:29
The total number of attempts to try the job until it completes.
Default Value
1
Inherited from
backoff?
optional backoff: number | BackoffOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:33
Backoff setting for automatic retries if the job fails
Inherited from
delay?
optional delay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:24
An amount of milliseconds to wait until this job can be processed. Note that for accurate delays, worker and producers should have their clocks synchronized.
Default Value
0
Inherited from
jobId?
optional jobId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:85
Override the job ID - by default, the job ID is a unique integer, but you can use this setting to override it. If you use this option, it is up to you to ensure the jobId is unique. If you attempt to add a job with an id that already exists, it will not be added.
keepLogs?
optional keepLogs: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:59
Maximum amount of log entries that will be preserved
Inherited from
lifo?
optional lifo: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:39
If true, adds the job to the right of the queue instead of the left (default false)
See
https://docs.bullmq.io/guide/jobs/lifo
Inherited from
parent?
optional parent: ParentOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:89
Parent options
prevMillis?
optional prevMillis: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:93
Internal property used by repeatable jobs.
priority?
optional priority: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:17
Ranges from 0 (highest priority) to 2 097 152 (lowest priority). Note that using priorities has a slight impact on performance, so do not use it if not required.
Default Value
0
Inherited from
removeOnComplete?
optional removeOnComplete: number | boolean | KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:47
If true, removes the job when it successfully completes When given a number, it specifies the maximum amount of jobs to keep, or you can provide an object specifying max age and/or count to keep. It overrides whatever setting is used in the worker. Default behavior is to keep the job in the completed set.
Inherited from
DefaultJobOptions.removeOnComplete
removeOnFail?
optional removeOnFail: number | boolean | KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:55
If true, removes the job when it fails after all attempts. When given a number, it specifies the maximum amount of jobs to keep, or you can provide an object specifying max age and/or count to keep. It overrides whatever setting is used in the worker. Default behavior is to keep the job in the failed set.
Inherited from
DefaultJobOptions.removeOnFail
repeat?
optional repeat: RepeatOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:73
Repeat this job, for example based on a cron schedule.
repeatJobKey?
optional repeatJobKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:77
Internal property used by repeatable jobs to save base repeat job key.
sizeLimit?
optional sizeLimit: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:67
Limits the size in bytes of the job's data payload (as a JSON serialized string).
Inherited from
stackTraceLimit?
optional stackTraceLimit: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:63
Limits the amount of stack trace lines that will be recorded in the stacktrace.
Inherited from
DefaultJobOptions.stackTraceLimit
timestamp?
optional timestamp: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:10
Timestamp when the job was created.
Default Value
Date.now()
Inherited from
BaseOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-options.d.ts:2
Properties
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-options.d.ts:3
url?
optional url: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-options.d.ts:4
BuiltInStrategies
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/backoffs.d.ts:4
Indexable
[index: string]: (delay, jitter?) => BackoffStrategy
BullModuleExtraOptions
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:6
Public Api
Properties
manualRegistration?
optional manualRegistration: boolean;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:11
If set to true, the module will not register the Bull queues automatically. This is useful when you want to manually register the queues.
BullModuleOptions
Defined in: packages/bullmq/src/bullmq-module-options.interface.ts:3
Extends
Omit<QueueOptions,"connection">
Properties
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
connection?
optional connection: ConnectionOptions;
Defined in: packages/bullmq/src/bullmq-module-options.interface.ts:4
defaultJobOptions?
optional defaultJobOptions: DefaultJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:49
Inherited from
BullRootModuleOptions.defaultJobOptions
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
settings?
optional settings: AdvancedRepeatOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:76
Advanced options for the repeatable jobs.
Inherited from
BullRootModuleOptions.settings
skipMetasUpdate?
optional skipMetasUpdate: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:72
Skip Meta update.
If true, the queue will not update the metadata of the queue. Useful for read-only systems that do should not update the metadata.
Default Value
false
Inherited from
BullRootModuleOptions.skipMetasUpdate
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
streams?
optional streams: {
events: {
maxLen: number;
};
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:53
Options for the streams used internally in BullMQ.
events
events: {
maxLen: number;
};
Options for the events stream.
events.maxLen
maxLen: number;
Max approximated length for streams. Default is 10 000 events.
Inherited from
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:34
Telemetry client
Inherited from
BullQueueAdvancedProcessor
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/bull-processor.interfaces.d.ts:6
Public Api
Extends
Partial<WorkerOptions>
Properties
autorun?
optional autorun: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:20
Condition to start processor at instance creation.
Default Value
true
Inherited from
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
callback
callback: BullQueueProcessorCallback;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/bull-processor.interfaces.d.ts:8
concurrency?
optional concurrency: number;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/bull-processor.interfaces.d.ts:7
Amount of jobs that a single worker is allowed to work on in parallel.
Default Value
1
See
https://docs.bullmq.io/guide/workers/concurrency
Overrides
connection?
optional connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
Inherited from
drainDelay?
optional drainDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:101
Number of seconds to long poll for jobs when the queue is empty.
Default Value
5
Inherited from
limiter?
optional limiter: RateLimiterOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:33
Enable rate limiter
See
https://docs.bullmq.io/guide/rate-limiting
Inherited from
lockDuration?
optional lockDuration: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:110
Duration of the lock for the job in milliseconds. The lock represents that a worker is processing the job. If the lock is lost, the job will be eventually be picked up by the stalled checker and move back to wait so that another worker can process it again.
Default Value
30000
Inherited from
lockRenewTime?
optional lockRenewTime: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:117
The time in milliseconds before the lock is automatically renewed.
It is not recommended to modify this value, which is by default set to halv the lockDuration value, which is optimal for most use cases.
Inherited from
maximumRateLimitDelay?
optional maximumRateLimitDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:45
Maximum time in milliseconds where the job is idle while being rate limited. While workers are idle because of a rate limiter, they won't fetch new jobs to process and delayed jobs won't be promoted.
Default Value
30000
Inherited from
WorkerOptions.maximumRateLimitDelay
maxStalledCount?
optional maxStalledCount: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:61
Amount of times a job can be recovered from a stalled state
to the wait state. If this is exceeded, the job is moved
to failed.
Default Value
1
Inherited from
maxStartedAttempts?
optional maxStartedAttempts: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:53
Defines the maximum number of times a job is allowed to start processing, regardless of whether it completes or fails. Each time a worker picks up the job and begins processing it, the attemptsStarted counter is incremented. If this counter reaches maxStartedAttempts, the job will be moved to the failed state with an UnrecoverableError.
Default Value
undefined
Inherited from
WorkerOptions.maxStartedAttempts
metrics?
optional metrics: MetricsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:38
Enable collect metrics.
See
https://docs.bullmq.io/guide/metrics
Inherited from
name?
optional name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:14
Optional worker name. The name will be stored on every job processed by this worker instance, and can be used to monitor which worker is processing or has processed a given job.
Inherited from
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
removeOnComplete?
optional removeOnComplete: KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:73
You can provide an object specifying max age and/or count to keep. Default behavior is to keep the job in the completed set.
Inherited from
WorkerOptions.removeOnComplete
removeOnFail?
optional removeOnFail: KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:79
You can provide an object specifying max age and/or count to keep. Default behavior is to keep the job in the failed set.
Inherited from
runRetryDelay?
optional runRetryDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:123
This is an internal option that should not be modified.
Default Value
15000
Inherited from
settings?
optional settings: AdvancedOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:127
More advanced options.
Inherited from
skipLockRenewal?
optional skipLockRenewal: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:95
Skip lock renewal for this worker. If set to true, the lock will expire after lockDuration and moved back to the wait queue (if the stalled check is not disabled)
Default Value
false
Inherited from
skipStalledCheck?
optional skipStalledCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:87
Skip stalled check for this worker. Note that other workers could still perform stalled checkd and move jobs back to wait for jobs being processed by this worker.
Default Value
false
Inherited from
WorkerOptions.skipStalledCheck
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
stalledInterval?
optional stalledInterval: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:67
Number of milliseconds between stallness checks.
Default Value
30000
Inherited from
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:139
Telemetry Addon
Inherited from
useWorkerThreads?
optional useWorkerThreads: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:135
Use Worker Threads instead of Child Processes. Note: This option can only be used when specifying a file for the processor argument.
Default Value
false
Inherited from
WorkerOptions.useWorkerThreads
workerForkOptions?
optional workerForkOptions: ForkOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:18
Support passing Worker Fork Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as false (default value).
See
https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options
Inherited from
SandboxedOptions.workerForkOptions
workerThreadsOptions?
optional workerThreadsOptions: WorkerOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:25
Support passing Worker Threads Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as true.
See
https://nodejs.org/api/worker_threads.html#new-workerfilename-options
Inherited from
SandboxedOptions.workerThreadsOptions
BullQueueAdvancedSeparateProcessor
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/bull-processor.interfaces.d.ts:10
Extends
Partial<WorkerOptions>
Properties
autorun?
optional autorun: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:20
Condition to start processor at instance creation.
Default Value
true
Inherited from
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
concurrency?
optional concurrency: number;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/bull-processor.interfaces.d.ts:11
Amount of jobs that a single worker is allowed to work on in parallel.
Default Value
1
See
https://docs.bullmq.io/guide/workers/concurrency
Overrides
connection?
optional connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
Inherited from
drainDelay?
optional drainDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:101
Number of seconds to long poll for jobs when the queue is empty.
Default Value
5
Inherited from
limiter?
optional limiter: RateLimiterOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:33
Enable rate limiter
See
https://docs.bullmq.io/guide/rate-limiting
Inherited from
lockDuration?
optional lockDuration: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:110
Duration of the lock for the job in milliseconds. The lock represents that a worker is processing the job. If the lock is lost, the job will be eventually be picked up by the stalled checker and move back to wait so that another worker can process it again.
Default Value
30000
Inherited from
lockRenewTime?
optional lockRenewTime: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:117
The time in milliseconds before the lock is automatically renewed.
It is not recommended to modify this value, which is by default set to halv the lockDuration value, which is optimal for most use cases.
Inherited from
maximumRateLimitDelay?
optional maximumRateLimitDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:45
Maximum time in milliseconds where the job is idle while being rate limited. While workers are idle because of a rate limiter, they won't fetch new jobs to process and delayed jobs won't be promoted.
Default Value
30000
Inherited from
WorkerOptions.maximumRateLimitDelay
maxStalledCount?
optional maxStalledCount: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:61
Amount of times a job can be recovered from a stalled state
to the wait state. If this is exceeded, the job is moved
to failed.
Default Value
1
Inherited from
maxStartedAttempts?
optional maxStartedAttempts: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:53
Defines the maximum number of times a job is allowed to start processing, regardless of whether it completes or fails. Each time a worker picks up the job and begins processing it, the attemptsStarted counter is incremented. If this counter reaches maxStartedAttempts, the job will be moved to the failed state with an UnrecoverableError.
Default Value
undefined
Inherited from
WorkerOptions.maxStartedAttempts
metrics?
optional metrics: MetricsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:38
Enable collect metrics.
See
https://docs.bullmq.io/guide/metrics
Inherited from
name?
optional name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:14
Optional worker name. The name will be stored on every job processed by this worker instance, and can be used to monitor which worker is processing or has processed a given job.
Inherited from
path
path: BullQueueSeparateProcessor;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/bull-processor.interfaces.d.ts:12
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
removeOnComplete?
optional removeOnComplete: KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:73
You can provide an object specifying max age and/or count to keep. Default behavior is to keep the job in the completed set.
Inherited from
WorkerOptions.removeOnComplete
removeOnFail?
optional removeOnFail: KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:79
You can provide an object specifying max age and/or count to keep. Default behavior is to keep the job in the failed set.
Inherited from
runRetryDelay?
optional runRetryDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:123
This is an internal option that should not be modified.
Default Value
15000
Inherited from
settings?
optional settings: AdvancedOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:127
More advanced options.
Inherited from
skipLockRenewal?
optional skipLockRenewal: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:95
Skip lock renewal for this worker. If set to true, the lock will expire after lockDuration and moved back to the wait queue (if the stalled check is not disabled)
Default Value
false
Inherited from
skipStalledCheck?
optional skipStalledCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:87
Skip stalled check for this worker. Note that other workers could still perform stalled checkd and move jobs back to wait for jobs being processed by this worker.
Default Value
false
Inherited from
WorkerOptions.skipStalledCheck
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
stalledInterval?
optional stalledInterval: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:67
Number of milliseconds between stallness checks.
Default Value
30000
Inherited from
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:139
Telemetry Addon
Inherited from
useWorkerThreads?
optional useWorkerThreads: boolean;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/bull-processor.interfaces.d.ts:13
Use Worker Threads instead of Child Processes. Note: This option can only be used when specifying a file for the processor argument.
Default Value
false
Overrides
WorkerOptions.useWorkerThreads
workerForkOptions?
optional workerForkOptions: ForkOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:18
Support passing Worker Fork Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as false (default value).
See
https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options
Inherited from
SandboxedOptions.workerForkOptions
workerThreadsOptions?
optional workerThreadsOptions: WorkerOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:25
Support passing Worker Threads Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as true.
See
https://nodejs.org/api/worker_threads.html#new-workerfilename-options
Inherited from
SandboxedOptions.workerThreadsOptions
BullRootModuleOptions
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:16
Public Api
Extends
Properties
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueOptions.blockingConnection
connection
connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
Inherited from
defaultJobOptions?
optional defaultJobOptions: DefaultJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:49
Inherited from
QueueOptions.defaultJobOptions
extraOptions?
optional extraOptions: BullModuleExtraOptions;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:17
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
settings?
optional settings: AdvancedRepeatOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:76
Advanced options for the repeatable jobs.
Inherited from
skipMetasUpdate?
optional skipMetasUpdate: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:72
Skip Meta update.
If true, the queue will not update the metadata of the queue. Useful for read-only systems that do should not update the metadata.
Default Value
false
Inherited from
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueOptions.skipWaitingForReady
streams?
optional streams: {
events: {
maxLen: number;
};
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:53
Options for the streams used internally in BullMQ.
events
events: {
maxLen: number;
};
Options for the events stream.
events.maxLen
maxLen: number;
Max approximated length for streams. Default is 10 000 events.
Inherited from
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:34
Telemetry client
Inherited from
ChildMessage
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts:2
Properties
cmd
cmd: ParentCommand;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts:3
err?
optional err: Record<string, any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts:6
requestId?
optional requestId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts:4
value?
optional value: any;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts:5
ContextManager
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:32
Context manager interface
The context manager is responsible for managing the context and propagating it across the application.
Type Parameters
| Type Parameter |
|---|
Context |
Methods
active()
active(): Context;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:43
Returns the active context
Returns
Context
fromMetadata()
fromMetadata(activeContext, metadata): Context;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:59
Creates a new context from a serialized version effectively linking the new context to the parent context.
Parameters
| Parameter | Type | Description |
|---|---|---|
activeContext | Context | the current active context |
metadata | string | the serialized version of the context |
Returns
Context
getMetadata()
getMetadata(context): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:51
Returns a serialized version of the current context. The metadata is the mechanism used to propagate the context across a distributed application.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Context | the current context |
Returns
string
with()
with<A>(context, fn): ReturnType<A>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:39
Creates a new context and sets it as active for the fn passed as last argument
Type Parameters
| Type Parameter |
|---|
A extends (...args) => any |
Parameters
| Parameter | Type | Description |
|---|---|---|
context | Context | the context to set as active |
fn | A | the function to execute with the context |
Returns
ReturnType<A>
DefaultJobOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:5
Extended by
Properties
attempts?
optional attempts: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:29
The total number of attempts to try the job until it completes.
Default Value
1
backoff?
optional backoff: number | BackoffOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:33
Backoff setting for automatic retries if the job fails
delay?
optional delay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:24
An amount of milliseconds to wait until this job can be processed. Note that for accurate delays, worker and producers should have their clocks synchronized.
Default Value
0
keepLogs?
optional keepLogs: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:59
Maximum amount of log entries that will be preserved
lifo?
optional lifo: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:39
If true, adds the job to the right of the queue instead of the left (default false)
See
https://docs.bullmq.io/guide/jobs/lifo
priority?
optional priority: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:17
Ranges from 0 (highest priority) to 2 097 152 (lowest priority). Note that using priorities has a slight impact on performance, so do not use it if not required.
Default Value
0
removeOnComplete?
optional removeOnComplete: number | boolean | KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:47
If true, removes the job when it successfully completes When given a number, it specifies the maximum amount of jobs to keep, or you can provide an object specifying max age and/or count to keep. It overrides whatever setting is used in the worker. Default behavior is to keep the job in the completed set.
removeOnFail?
optional removeOnFail: number | boolean | KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:55
If true, removes the job when it fails after all attempts. When given a number, it specifies the maximum amount of jobs to keep, or you can provide an object specifying max age and/or count to keep. It overrides whatever setting is used in the worker. Default behavior is to keep the job in the failed set.
sizeLimit?
optional sizeLimit: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:67
Limits the size in bytes of the job's data payload (as a JSON serialized string).
stackTraceLimit?
optional stackTraceLimit: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:63
Limits the amount of stack trace lines that will be recorded in the stacktrace.
timestamp?
optional timestamp: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts:10
Timestamp when the job was created.
Default Value
Date.now()
DependenciesOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:28
Properties
failed?
optional failed: DependencyOpts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:32
Options for failed child pagination
ignored?
optional ignored: DependencyOpts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:36
Options for ignored child pagination
processed?
optional processed: DependencyOpts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:40
Options for processed child pagination
unprocessed?
optional unprocessed: DependencyOpts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:44
Options for unprocessed child pagination
DependencyOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:18
Properties
count?
optional count: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:26
Max quantity of jobs to be retrieved
cursor?
optional cursor: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:22
Cursor value to be passed for pagination
FlowJobBase
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:3
Type Parameters
| Type Parameter |
|---|
T |
Properties
children?
optional children: FlowChildJob[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:9
data?
optional data: any;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:6
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:4
opts?
optional opts: Omit<T, "repeat">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:8
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:7
queueName
queueName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:5
FlowOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:14
Properties
queuesOptions
queuesOptions: FlowQueuesOpts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:18
Map of options for Queue classes.
FlowProducerListener
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:54
Extends
Properties
error()
error: (failedReason) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:60
Listen to 'error' event.
This event is triggered when an error is throw.
Parameters
| Parameter | Type |
|---|---|
failedReason | Error |
Returns
void
ioredis:close()
ioredis:close: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/ioredis-events.d.ts:7
Listen to 'ioredis:close' event.
This event is triggered when ioredis is closed.
Returns
void
Inherited from
GetNextJobOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:141
Properties
block?
optional block: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:142
IConnection
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/connection.d.ts:4
Extends
EventEmitter
Properties
client
client: Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/connection.d.ts:6
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error,
event, ...
args): void;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:103
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
EventEmitter.[captureRejectionSymbol]
addListener()
addListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:642
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.addListener
emit()
emit<K>(eventName, ...args): boolean;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:904
Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments
to each.
Returns true if the event had listeners, false otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
...args | AnyRest |
Returns
boolean
Since
v0.1.26
Inherited from
EventEmitter.emit
eventNames()
eventNames(): (string | symbol)[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:967
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});
const sym = Symbol('symbol');
myEE.on(sym, () => {});
console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]
Returns
(string | symbol)[]
Since
v6.0.0
Inherited from
EventEmitter.eventNames
getMaxListeners()
getMaxListeners(): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:819
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
EventEmitter.getMaxListeners
listenerCount()
listenerCount<K>(eventName, listener?): number;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:913
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
EventEmitter.listenerCount
listeners()
listeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:832
Returns a copy of the array of listeners for the event named eventName.
server.on('connection', (stream) => {
console.log('someone connected!');
});
console.log(util.inspect(server.listeners('connection')));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
EventEmitter.listeners
off()
off<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:792
Alias for emitter.removeListener().
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v10.0.0
Inherited from
EventEmitter.off
on()
on<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:674
Adds the listener function to the end of the listeners array for the event
named eventName. No checks are made to see if the listener has already
been added. Multiple calls passing the same combination of eventName and
listener will result in the listener being added, and called, multiple times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.on('foo', () => console.log('a'));
myEE.prependListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.1.101
Inherited from
EventEmitter.on
once()
once<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:704
Adds a one-time listener function for the event named eventName. The
next time eventName is triggered, this listener is removed and then invoked.
server.once('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
import { EventEmitter } from 'node:events';
const myEE = new EventEmitter();
myEE.once('foo', () => console.log('a'));
myEE.prependOnceListener('foo', () => console.log('b'));
myEE.emit('foo');
// Prints:
// b
// a
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v0.3.0
Inherited from
EventEmitter.once
prependListener()
prependListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:931
Adds the listener function to the beginning of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple times.
server.prependListener('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependListener
prependOnceListener()
prependOnceListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:947
Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this
listener is removed, and then invoked.
server.prependOnceListener('connection', (stream) => {
console.log('Ah, we have our first user!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event. |
listener | (...args) => void | The callback function |
Returns
this
Since
v6.0.0
Inherited from
EventEmitter.prependOnceListener
rawListeners()
rawListeners<K>(eventName): Function[];
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:863
Returns a copy of the array of listeners for the event named eventName,
including any wrappers (such as those created by .once()).
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.once('log', () => console.log('log once'));
// Returns a new Array with a function `onceWrapper` which has a property
// `listener` which contains the original listener bound above
const listeners = emitter.rawListeners('log');
const logFnWrapper = listeners[0];
// Logs "log once" to the console and does not unbind the `once` event
logFnWrapper.listener();
// Logs "log once" to the console and removes the listener
logFnWrapper();
emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v9.4.0
Inherited from
EventEmitter.rawListeners
removeAllListeners()
removeAllListeners(eventName?): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:803
Removes all listeners, or those of the specified eventName.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter instance was created by some other
component or module (e.g. sockets or file streams).
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
eventName? | string | symbol |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeAllListeners
removeListener()
removeListener<K>(eventName, listener): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:787
Removes the specified listener from the listener array for the event named eventName.
const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
// ...
server.removeListener('connection', callback);
removeListener() will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified eventName, then removeListener() must be
called multiple times to remove each instance.
Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any removeListener() or removeAllListeners() calls after emitting and before the last listener finishes execution
will not remove them fromemit() in progress. Subsequent events behave as expected.
import { EventEmitter } from 'node:events';
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
const callbackB = () => {
console.log('B');
};
myEmitter.on('event', callbackA);
myEmitter.on('event', callbackB);
// callbackA removes listener callbackB but it will still be called.
// Internal listener array at time of emit [callbackA, callbackB]
myEmitter.emit('event');
// Prints:
// A
// B
// callbackB is now removed.
// Internal listener array [callbackA]
myEmitter.emit('event');
// Prints:
// A
Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered after the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the emitter.listeners() method will need to be recreated.
When a single function has been added as a handler multiple times for a single
event (as in the example below), removeListener() will remove the most
recently added instance. In the example the once('ping') listener is removed:
import { EventEmitter } from 'node:events';
const ee = new EventEmitter();
function pong() {
console.log('pong');
}
ee.on('ping', pong);
ee.once('ping', pong);
ee.removeListener('ping', pong);
ee.emit('ping');
ee.emit('ping');
Returns a reference to the EventEmitter, so that calls can be chained.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args) => void |
Returns
this
Since
v0.1.26
Inherited from
EventEmitter.removeListener
setMaxListeners()
setMaxListeners(n): this;
Defined in: node_modules/.pnpm/@types+node@22.19.3/node_modules/@types/node/events.d.ts:813
By default EventEmitters will print a warning if more than 10 listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The emitter.setMaxListeners() method allows the limit to be
modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
Returns a reference to the EventEmitter, so that calls can be chained.
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
this
Since
v0.3.5
Inherited from
EventEmitter.setMaxListeners
waitUntilReady()
waitUntilReady(): Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/connection.d.ts:5
Returns
Promise<boolean>
IoredisListener
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/ioredis-events.d.ts:1
Extended by
Properties
ioredis:close()
ioredis:close: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/ioredis-events.d.ts:7
Listen to 'ioredis:close' event.
This event is triggered when ioredis is closed.
Returns
void
JobJson
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:4
Properties
attemptsMade
attemptsMade: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:10
attemptsStarted
attemptsStarted: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:11
data
data: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:7
debounceId?
optional debounceId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:22
deduplicationId?
optional deduplicationId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:23
failedReason
failedReason: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:15
finishedOn?
optional finishedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:12
id
id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:5
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:6
nextRepeatableJobKey?
optional nextRepeatableJobKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:21
opts
opts: RedisJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:8
parent?
optional parent: ParentKeys;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:18
parentKey?
optional parentKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:19
processedBy?
optional processedBy: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:24
processedOn?
optional processedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:13
progress
progress: JobProgress;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:9
repeatJobKey?
optional repeatJobKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:20
returnvalue
returnvalue: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:17
stacktrace
stacktrace: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:16
stalledCounter
stalledCounter: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:25
timestamp
timestamp: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:14
JobJsonRaw
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:27
Properties
atm?
optional atm: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:47
ats?
optional ats: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:50
attemptsMade?
optional attemptsMade: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:34
data
data: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:30
defa?
optional defa: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:48
deid?
optional deid: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:44
delay
delay: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:31
failedReason
failedReason: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:39
finishedOn?
optional finishedOn: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:35
id
id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:28
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:29
nrjid?
optional nrjid: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:46
opts
opts: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:32
parent?
optional parent: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:43
parentKey?
optional parentKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:42
pb?
optional pb: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:51
priority
priority: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:37
processedOn?
optional processedOn: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:36
progress
progress: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:33
returnvalue
returnvalue: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:41
rjk?
optional rjk: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:45
stacktrace?
optional stacktrace: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:40
stc?
optional stc: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:49
timestamp
timestamp: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:38
JobNode
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:50
Properties
children?
optional children: JobNode[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:52
job
job: Job;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:51
JobSchedulerJson
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:6
Type Parameters
| Type Parameter |
|---|
D |
Properties
endDate?
optional endDate: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:13
every?
optional every: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:16
id?
optional id: string | null;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:9
iterationCount?
optional iterationCount: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:10
key
key: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:7
limit?
optional limit: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:11
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:8
next?
optional next: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:17
offset?
optional offset: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:18
pattern?
optional pattern: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:15
startDate?
optional startDate: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:12
template?
optional template: JobSchedulerTemplateJson<D>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:19
tz?
optional tz: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:14
JobSchedulerTemplateJson
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:2
Type Parameters
| Type Parameter |
|---|
D |
Properties
data?
optional data: D;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:3
opts?
optional opts: JobSchedulerTemplateOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts:4
KeepJobs
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/keep-jobs.d.ts:8
KeepJobs
Specify which jobs to keep after finishing. If both age and count are specified, then the jobs kept will be the ones that satisfies both properties.
Properties
age?
optional age: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/keep-jobs.d.ts:12
Maximum age in seconds for job to be kept.
count?
optional count: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/keep-jobs.d.ts:16
Maximum count of jobs to be kept.
LockManagerOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:3
Properties
lockDuration
lockDuration: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:5
lockRenewTime
lockRenewTime: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:4
workerId
workerId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:6
workerName?
optional workerName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:7
LockManagerWorkerContext
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:13
Minimal interface that LockManager needs from Worker. This allows LockManager to access worker methods without inheriting from QueueBase.
Properties
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:29
Queue name for telemetry.
Methods
emit()
emit(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:21
Emits events to worker listeners.
Parameters
| Parameter | Type |
|---|---|
event | string | symbol |
...args | any[] |
Returns
boolean
extendJobLocks()
extendJobLocks(
jobIds,
tokens,
duration): Promise<string[]>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:17
Extends locks for multiple jobs.
Parameters
| Parameter | Type |
|---|---|
jobIds | string[] |
tokens | string[] |
duration | number |
Returns
Promise<string[]>
trace()
trace<T>(
spanKind,
operation,
destination,
callback): T | Promise<T>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/lock-manager.d.ts:25
Wraps code with telemetry tracing.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
spanKind | any |
operation | string |
destination | string |
callback | (span?) => T | Promise<T> |
Returns
T | Promise<T>
Metrics
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/metrics.d.ts:1
Properties
count
count: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/metrics.d.ts:8
data
data: number[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/metrics.d.ts:7
meta
meta: {
count: number;
prevCount: number;
prevTS: number;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/metrics.d.ts:2
count
count: number;
prevCount
prevCount: number;
prevTS
prevTS: number;
MetricsOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/metrics-options.d.ts:5
Properties
maxDataPoints?
optional maxDataPoints: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/metrics-options.d.ts:11
Enable gathering metrics for finished jobs. Output refers to all finished jobs, completed or failed.
MinimalJob
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:49
MinimalJob
Type Parameters
| Type Parameter |
|---|
DataType |
ReturnType |
NameType extends string |
Properties
attemptsMade
attemptsMade: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:91
Number of attempts after the job has failed.
Default Value
0
data
data: DataType;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:57
The payload for this job.
delay
delay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:82
An amount of milliseconds to wait until this job can be processed.
Default Value
0
failedReason
failedReason: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:95
Reason for failing.
finishedOn?
optional finishedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:99
Timestamp for when the job finished (completed or failed).
id?
optional id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:62
name
name: NameType;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:53
The name of the Job
opts
opts: JobsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:61
The options object for this job.
parent?
optional parent: ParentKeys;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:111
Object that contains parentId (id) and parent queueKey.
parentKey?
optional parentKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:107
Fully qualified key (including the queue prefix) pointing to the parent of this job.
processedOn?
optional processedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:103
Timestamp for when the job was processed.
progress
progress: JobProgress;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:67
The progress a job has performed so far.
Default Value
0
repeatJobKey?
optional repeatJobKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:115
Base repeat job key.
returnvalue
returnvalue: ReturnType;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:72
The value returned by the processor when processing this job.
Default Value
null
stacktrace
stacktrace: string[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:77
Stacktrace for the error (for failed jobs).
Default Value
null
timestamp
timestamp: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:86
Timestamp when the job was created (unless overridden with job options).
Accessors
prefix
Get Signature
get prefix(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:148
Returns
string
the prefix that is used.
queueName
Get Signature
get queueName(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:144
Returns
string
queueQualifiedName
Get Signature
get queueQualifiedName(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:153
See
https://www.gnu.org/software/gawk/manual/html_node/Qualified-Names.html
Returns
string
it includes the prefix, the namespace separator :, and queue name.
Methods
asJSON()
asJSON(): JobJson;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:120
Prepares a job to be serialized for storage in Redis.
Returns
asJSONSandbox()
asJSONSandbox(): JobJsonSandbox;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:125
Prepares a job to be passed to Sandbox.
Returns
log()
log(logRow): Promise<number>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:143
Logs one row of log data.
Parameters
| Parameter | Type | Description |
|---|---|---|
logRow | string | string with log data to be logged. |
Returns
Promise<number>
updateData()
updateData(data): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:131
Updates a job's data
Parameters
| Parameter | Type | Description |
|---|---|---|
data | DataType | the data that will replace the current jobs data. |
Returns
Promise<void>
updateProgress()
updateProgress(progress): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:137
Updates a job's progress
Parameters
| Parameter | Type | Description |
|---|---|---|
progress | JobProgress | number or object to be saved as progress. |
Returns
Promise<void>
MinimalQueue
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:5
Extends
Properties
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:8
Inherited from
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:7
Inherited from
name
readonly name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:6
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:5
Inherited from
qualifiedName
readonly qualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:7
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:6
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Inherited from
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:12
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
Inherited from
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:16
Returns the version of the Redis instance the client is connected to,
Returns
string
Inherited from
ScriptQueueContext.redisVersion
Methods
emit()
emit(event, ...args): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:15
Emits an event. Normally used by subclasses to emit events.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | symbol | The emitted event. |
...args | any[] | - |
Returns
boolean
on()
on(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:16
Parameters
| Parameter | Type |
|---|---|
event | string | symbol |
listener | (...args) => void |
Returns
this
removeListener()
removeListener(event, listener): this;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:17
Parameters
| Parameter | Type |
|---|---|
event | string | symbol |
listener | (...args) => void |
Returns
this
trace()
trace<T>(
spanKind,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T | Promise<T>>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:29
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T | Promise<T>>
waitUntilReady()
waitUntilReady(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-queue.d.ts:18
Returns
Promise<RedisClient>
MoveToDelayedOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:8
Properties
fieldsToUpdate?
optional fieldsToUpdate: Record<string, any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:10
skipAttempt?
optional skipAttempt: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:9
MoveToWaitingChildrenOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:15
Properties
child?
optional child: ParentOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:16
NodeOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:28
Properties
depth?
optional depth: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:44
Maximum depth or levels to visit in the tree.
id
id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:40
Root job id.
maxChildren?
optional maxChildren: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:48
Maximum quantity of children per type (processed, unprocessed).
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:36
Prefix included in job key.
queueName
queueName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts:32
Root job queue name.
ObliterateOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:8
Properties
count?
optional count: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:18
Use count with the maximum number of deleted keys per iteration
Default Value
1000
force?
optional force: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:13
Use force = true to force obliteration even with active jobs in the queue
Default Value
false
OnQueueEventMetadata
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/on-queue-event.decorator.d.ts:5
Public Api
Properties
eventName
eventName: keyof QueueEventsListener;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/on-queue-event.decorator.d.ts:6
OnWorkerEventMetadata
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/on-worker-event.decorator.d.ts:5
Public Api
Properties
eventName
eventName: keyof WorkerListener<any, any, string>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/on-worker-event.decorator.d.ts:6
Parent
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:5
Describes the parent for a Job.
Type Parameters
| Type Parameter |
|---|
T |
Properties
data?
optional data: T;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:9
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:6
opts?
optional opts: JobsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:10
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:7
queue?
optional queue: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:8
ParentKeys
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:12
Properties
cpof?
optional cpof: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:18
fpof?
optional fpof: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:15
id?
optional id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:13
idof?
optional idof: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:17
queueKey
queueKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:14
rdof?
optional rdof: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:16
ParentMessage
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-message.d.ts:3
Properties
cmd
cmd: ChildCommand;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-message.d.ts:4
err?
optional err: Error;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-message.d.ts:6
job?
optional job: JobJson;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-message.d.ts:7
value?
optional value: any;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-message.d.ts:5
ParentOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-options.d.ts:1
Properties
id
id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-options.d.ts:5
Parent identifier.
queue
queue: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent-options.d.ts:10
It includes the prefix, the namespace separator :, and queue name.
See
https://www.gnu.org/software/gawk/manual/html_node/Qualified-Names.html
ProcessorOptions
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/processor.decorator.d.ts:6
Public Api
Properties
configKey?
optional configKey: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/processor.decorator.d.ts:18
A key (configuration key) under which the queue/connection configuration should be available.
name?
optional name: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/processor.decorator.d.ts:10
Specifies the name of the queue to subscribe to.
scope?
optional scope: Scope;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/processor.decorator.d.ts:14
Specifies the lifetime of an injected Processor.
QueueBaseOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:12
Base Queue options
Extended by
Properties
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
connection
connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:34
Telemetry client
QueueEventsOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:87
Options for QueueEvents
Extends
Omit<QueueBaseOptions,"telemetry">
Properties
autorun?
optional autorun: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:91
Condition to start listening to events at instance creation.
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
blockingTimeout?
optional blockingTimeout: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:101
Timeout for the blocking XREAD call to the events stream.
connection
connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
Inherited from
lastEventId?
optional lastEventId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:97
Last event Id. If provided it is possible to continue consuming events from a known Id instead of from the last produced event.
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
QueueListener
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:20
Extends
Type Parameters
| Type Parameter |
|---|
JobBase extends Job |
Properties
cleaned()
cleaned: (jobs, type) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:26
Listen to 'cleaned' event.
This event is triggered when the queue calls clean method.
Parameters
| Parameter | Type |
|---|---|
jobs | string[] |
type | string |
Returns
void
error()
error: (err) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:32
Listen to 'error' event.
This event is triggered when an error is thrown.
Parameters
| Parameter | Type |
|---|---|
err | Error |
Returns
void
ioredis:close()
ioredis:close: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/ioredis-events.d.ts:7
Listen to 'ioredis:close' event.
This event is triggered when ioredis is closed.
Returns
void
Inherited from
paused()
paused: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:38
Listen to 'paused' event.
This event is triggered when the queue is paused.
Returns
void
progress()
progress: (jobId, progress) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:44
Listen to 'progress' event.
This event is triggered when the job updates its progress.
Parameters
| Parameter | Type |
|---|---|
jobId | string |
progress | JobProgress |
Returns
void
removed()
removed: (jobId) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:50
Listen to 'removed' event.
This event is triggered when a job is removed.
Parameters
| Parameter | Type |
|---|---|
jobId | string |
Returns
void
resumed()
resumed: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:56
Listen to 'resumed' event.
This event is triggered when the queue is resumed.
Returns
void
waiting()
waiting: (job) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue.d.ts:62
Listen to 'waiting' event.
This event is triggered when the queue creates a new job.
Parameters
| Parameter | Type |
|---|---|
job | JobBase |
Returns
void
QueueMeta
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-meta.d.ts:1
Properties
concurrency?
optional concurrency: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-meta.d.ts:2
duration?
optional duration: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-meta.d.ts:4
max?
optional max: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-meta.d.ts:3
maxLenEvents?
optional maxLenEvents: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-meta.d.ts:5
paused?
optional paused: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-meta.d.ts:6
version?
optional version: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-meta.d.ts:7
QueueOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:48
Options for the Queue class.
Extends
Extended by
Properties
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
connection
connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
Inherited from
defaultJobOptions?
optional defaultJobOptions: DefaultJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:49
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
settings?
optional settings: AdvancedRepeatOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:76
Advanced options for the repeatable jobs.
skipMetasUpdate?
optional skipMetasUpdate: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:72
Skip Meta update.
If true, the queue will not update the metadata of the queue. Useful for read-only systems that do should not update the metadata.
Default Value
false
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
streams?
optional streams: {
events: {
maxLen: number;
};
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:53
Options for the streams used internally in BullMQ.
events
events: {
maxLen: number;
};
Options for the events stream.
events.maxLen
maxLen: number;
Max approximated length for streams. Default is 10 000 events.
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:34
Telemetry client
Inherited from
RateLimiterOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/rate-limiter-options.d.ts:1
Properties
duration
duration: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/rate-limiter-options.d.ts:11
Time in milliseconds. During this time, a maximum
of max jobs will be processed.
max
max: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/rate-limiter-options.d.ts:6
Max number of jobs to process in the time period
specified in duration.
RawCommand
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:7
Properties
content
content: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:8
keys
keys: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:10
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts:9
Receiver
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/receiver.d.ts:1
Properties
off()
off: (evt, cb) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/receiver.d.ts:3
Parameters
| Parameter | Type |
|---|---|
evt | "message" |
cb | (msg) => void |
Returns
void
on()
on: (evt, cb) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/receiver.d.ts:2
Parameters
| Parameter | Type |
|---|---|
evt | "message" |
cb | (msg) => void |
Returns
void
RegisterFlowProducerAsyncOptions
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:33
Public Api
Extends
Pick<ModuleMetadata,"imports">
Properties
configKey?
optional configKey: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:43
Shared configuration key.
imports?
optional imports: (
| DynamicModule
| Type<any>
| Promise<DynamicModule>
| ForwardReference<any>)[];
Defined in: node_modules/.pnpm/@nestjs+common@11.1.9/node_modules/@nestjs/common/interfaces/modules/module-metadata.interface.d.ts:18
Optional list of imported modules that export the providers which are required in this module.
Inherited from
Pick.imports
inject?
optional inject: (InjectionToken | OptionalFactoryDependency)[];
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:59
Optional list of providers to be injected into the context of the Factory function.
name?
optional name: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:39
Flow name.
Default
default
useClass?
optional useClass: Type<RegisterFlowProducerOptionsFactory>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:51
Type (class name) of provider (instance to be registered and injected).
useExisting?
optional useExisting: Type<RegisterFlowProducerOptionsFactory>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:47
Existing Provider to be used.
useFactory()?
optional useFactory: (...args) =>
| RegisterFlowProducerOptions
| Promise<RegisterFlowProducerOptions>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:55
Factory function that returns an instance of the provider to be injected.
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
| RegisterFlowProducerOptions
| Promise<RegisterFlowProducerOptions>
RegisterFlowProducerOptions
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:7
Public Api
Extends
PartialThisParameter<QueueBaseOptions,"connection">
Properties
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
configKey?
optional configKey: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:19
Shared configuration key
Default
default
connection?
optional connection: ConnectionOptions;
Inherited from
RegisterFlowProducerOptions.connection
forceDisconnectOnShutdown?
optional forceDisconnectOnShutdown: boolean;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:25
When true, the flow will be force disconnected from Redis in the "onApplicationShutdown" lifecycle event.
Otherwise, the flow will be gracefully disconnected.
Default
true
name?
optional name: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:13
Flow name
Default
default
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:34
Telemetry client
Inherited from
RegisterFlowProducerOptionsFactory
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:27
Methods
createRegisterQueueOptions()
createRegisterQueueOptions():
| RegisterFlowProducerOptions
| Promise<RegisterFlowProducerOptions>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-flow-options.interface.d.ts:28
Returns
| RegisterFlowProducerOptions
| Promise<RegisterFlowProducerOptions>
RegisterQueueAsyncOptions
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:46
Public Api
Extends
Pick<ModuleMetadata,"imports">
Properties
configKey?
optional configKey: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:56
Shared configuration key.
extraProviders?
optional extraProviders: Provider[];
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:76
Extra providers to be registered in the module context.
imports?
optional imports: (
| DynamicModule
| Type<any>
| Promise<DynamicModule>
| ForwardReference<any>)[];
Defined in: node_modules/.pnpm/@nestjs+common@11.1.9/node_modules/@nestjs/common/interfaces/modules/module-metadata.interface.d.ts:18
Optional list of imported modules that export the providers which are required in this module.
Inherited from
Pick.imports
inject?
optional inject: (InjectionToken | OptionalFactoryDependency)[];
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:72
Optional list of providers to be injected into the context of the Factory function.
name?
optional name: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:52
Queue name.
Default
default
useClass?
optional useClass: Type<RegisterQueueOptionsFactory>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:64
Type (class name) of provider (instance to be registered and injected).
useExisting?
optional useExisting: Type<RegisterQueueOptionsFactory>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:60
Existing Provider to be used.
useFactory()?
optional useFactory: (...args) =>
| RegisterQueueOptions
| Promise<RegisterQueueOptions>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:68
Factory function that returns an instance of the provider to be injected.
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
| RegisterQueueOptions
| Promise<RegisterQueueOptions>
RegisterQueueOptions
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:8
Public Api
Extends
PartialThisParameter<QueueOptions,"connection">
Extended by
Properties
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
configKey?
optional configKey: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:20
Shared configuration key
Default
default
connection?
optional connection: ConnectionOptions;
Inherited from
RegisterFlowProducerOptions.connection
defaultJobOptions?
optional defaultJobOptions: DefaultJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:49
Inherited from
BullRootModuleOptions.defaultJobOptions
forceDisconnectOnShutdown?
optional forceDisconnectOnShutdown: boolean;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:35
When true, the queue will be force disconnected from Redis in the "onApplicationShutdown" lifecycle event.
Otherwise, the queue will be gracefully disconnected.
Default
false
name?
optional name: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:14
Queue name
Default
default
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
processors?
optional processors: BullQueueProcessor[];
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:24
Additional queue processors
settings?
optional settings: AdvancedRepeatOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:76
Advanced options for the repeatable jobs.
Inherited from
BullRootModuleOptions.settings
sharedConnection?
optional sharedConnection: boolean;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:29
Deprecated
This option is not supported in BullMQ 5 and considered a bad practice in prior versions.
skipMetasUpdate?
optional skipMetasUpdate: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:72
Skip Meta update.
If true, the queue will not update the metadata of the queue. Useful for read-only systems that do should not update the metadata.
Default Value
false
Inherited from
BullRootModuleOptions.skipMetasUpdate
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
streams?
optional streams: {
events: {
maxLen: number;
};
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:53
Options for the streams used internally in BullMQ.
events
events: {
maxLen: number;
};
Options for the events stream.
events.maxLen
maxLen: number;
Max approximated length for streams. Default is 10 000 events.
Inherited from
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:34
Telemetry client
Inherited from
RegisterQueueOptionsFactory
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:40
Public Api
Methods
createRegisterQueueOptions()
createRegisterQueueOptions():
| RegisterQueueOptions
| Promise<RegisterQueueOptions>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/register-queue-options.interface.d.ts:41
Returns
| RegisterQueueOptions
| Promise<RegisterQueueOptions>
RepeatBaseOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:81
Options for the Repeat class.
Extends
Properties
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
connection
connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
Inherited from
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
settings?
optional settings: AdvancedRepeatOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:82
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:34
Telemetry client
Inherited from
RepeatOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:7
Settings for repeatable jobs
See
https://docs.bullmq.io/guide/jobs/repeatable
Extends
Omit<ParserOptions,"iterator">
Properties
count?
optional count: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:36
The start value for the repeat iteration count.
currentDate?
optional currentDate: DateType;
Defined in: node_modules/.pnpm/cron-parser@4.9.0/node_modules/cron-parser/types/common.d.ts:90
Inherited from
Omit.currentDate
endDate?
optional endDate: DateType;
Defined in: node_modules/.pnpm/cron-parser@4.9.0/node_modules/cron-parser/types/common.d.ts:92
Inherited from
Omit.endDate
every?
optional every: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:27
Repeat after this amount of milliseconds
(pattern setting cannot be used together with this setting.)
immediately?
optional immediately: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:32
Repeated job should start right now ( work only with cron settings)
jobId?
optional jobId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:49
Internal property to store de job id
Deprecated
not in use anymore
key?
optional key: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:18
Custom repeatable key. This is the key that holds the "metadata" of a given repeatable job. This key is normally auto-generated but it is sometimes useful to specify a custom key for easier retrieval of repeatable jobs.
limit?
optional limit: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:22
Number of times the job should repeat at max.
nthDayOfWeek?
optional nthDayOfWeek: number;
Defined in: node_modules/.pnpm/cron-parser@4.9.0/node_modules/cron-parser/types/common.d.ts:95
Inherited from
Omit.nthDayOfWeek
offset?
optional offset: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:40
Offset in milliseconds to affect the next iteration time
pattern?
optional pattern: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:11
A repeat pattern
prevMillis?
optional prevMillis: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts:44
Internal property to store the previous time the job was executed.
startDate?
optional startDate: DateType;
Defined in: node_modules/.pnpm/cron-parser@4.9.0/node_modules/cron-parser/types/common.d.ts:91
Inherited from
Omit.startDate
tz?
optional tz: string;
Defined in: node_modules/.pnpm/cron-parser@4.9.0/node_modules/cron-parser/types/common.d.ts:94
Inherited from
Omit.tz
utc?
optional utc: boolean;
Defined in: node_modules/.pnpm/cron-parser@4.9.0/node_modules/cron-parser/types/common.d.ts:93
Inherited from
Omit.utc
RetryJobOpts
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:12
Properties
fieldsToUpdate?
optional fieldsToUpdate: Record<string, any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:13
RetryOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/retry-options.d.ts:4
Retry method options
Properties
resetAttemptsMade?
optional resetAttemptsMade: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/retry-options.d.ts:8
Attempts made counter is reset to zero when retrying the job.
resetAttemptsStarted?
optional resetAttemptsStarted: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/retry-options.d.ts:12
Attempts started counter is reset to zero when retrying the job.
SandboxedJob
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:6
See
https://docs.bullmq.io/guide/workers/sandboxed-processors
Extends
Omit<JobJsonSandbox,"data"|"opts"|"returnValue">
Type Parameters
| Type Parameter |
|---|
T |
R |
Properties
attemptsMade
attemptsMade: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:10
Inherited from
attemptsStarted
attemptsStarted: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:11
Inherited from
data
data: T;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:7
debounceId?
optional debounceId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:22
Inherited from
deduplicationId?
optional deduplicationId: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:23
Inherited from
failedReason
failedReason: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:15
Inherited from
finishedOn?
optional finishedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:12
Inherited from
id
id: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:5
Inherited from
log()
log: (row) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:13
Parameters
| Parameter | Type |
|---|---|
row | any |
Returns
void
moveToDelayed()
moveToDelayed: (timestamp, token?) => Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:10
Parameters
| Parameter | Type |
|---|---|
timestamp | number |
token? | string |
Returns
Promise<void>
moveToWait()
moveToWait: (token?) => Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:11
Parameters
| Parameter | Type |
|---|---|
token? | string |
Returns
Promise<void>
moveToWaitingChildren()
moveToWaitingChildren: (token?, opts?) => Promise<boolean>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:12
Parameters
| Parameter | Type |
|---|---|
token? | string |
opts? | MoveToWaitingChildrenOpts |
Returns
Promise<boolean>
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:6
Inherited from
nextRepeatableJobKey?
optional nextRepeatableJobKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:21
Inherited from
opts
opts: JobsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:8
parent?
optional parent: ParentKeys;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:18
Inherited from
parentKey?
optional parentKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:19
Inherited from
prefix
prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-json-sandbox.d.ts:5
Inherited from
Omit.prefix
processedBy?
optional processedBy: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:24
Inherited from
processedOn?
optional processedOn: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:13
Inherited from
progress
progress: JobProgress;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:9
Inherited from
queueName
queueName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-json-sandbox.d.ts:3
Inherited from
Omit.queueName
queueQualifiedName
queueQualifiedName: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:9
Overrides
Omit.queueQualifiedName
repeatJobKey?
optional repeatJobKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:20
Inherited from
returnvalue
returnvalue: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:17
Inherited from
returnValue
returnValue: R;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:16
stacktrace
stacktrace: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:16
Inherited from
stalledCounter
stalledCounter: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:25
Inherited from
timestamp
timestamp: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts:14
Inherited from
updateData()
updateData: (data) => Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:14
Parameters
| Parameter | Type |
|---|---|
data | any |
Returns
Promise<void>
updateProgress()
updateProgress: (value) => Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts:15
Parameters
| Parameter | Type |
|---|---|
value | JobProgress |
Returns
Promise<void>
SandboxedOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:3
Extended by
Properties
useWorkerThreads?
optional useWorkerThreads: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:11
Use Worker Threads instead of Child Processes. Note: This option can only be used when specifying a file for the processor argument.
Default Value
false
workerForkOptions?
optional workerForkOptions: ForkOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:18
Support passing Worker Fork Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as false (default value).
See
https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options
workerThreadsOptions?
optional workerThreadsOptions: WorkerOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:25
Support passing Worker Threads Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as true.
See
https://nodejs.org/api/worker_threads.html#new-workerfilename-options
ScriptQueueContext
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:4
Extended by
Properties
closing
closing: Promise<void> | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:8
keys
keys: KeysMap;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:7
opts
opts: QueueBaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:5
toKey()
toKey: (type) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:6
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
Accessors
client
Get Signature
get client(): Promise<RedisClient>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:12
Returns a promise that resolves to a redis client. Normally used only by subclasses.
Returns
Promise<RedisClient>
redisVersion
Get Signature
get redisVersion(): string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/script-queue-context.d.ts:16
Returns the version of the Redis instance the client is connected to,
Returns
string
SharedBullAsyncConfiguration
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:28
Public Api
Extends
Pick<ModuleMetadata,"imports">
Properties
extraOptions?
optional extraOptions: BullModuleExtraOptions;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:48
Extra options for the Bull module.
extraProviders?
optional extraProviders: Provider[];
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:52
Extra providers to be registered in the module context.
imports?
optional imports: (
| DynamicModule
| Type<any>
| Promise<DynamicModule>
| ForwardReference<any>)[];
Defined in: node_modules/.pnpm/@nestjs+common@11.1.9/node_modules/@nestjs/common/interfaces/modules/module-metadata.interface.d.ts:18
Optional list of imported modules that export the providers which are required in this module.
Inherited from
Pick.imports
inject?
optional inject: (InjectionToken | OptionalFactoryDependency)[];
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:44
Optional list of providers to be injected into the context of the Factory function.
useClass?
optional useClass: Type<SharedBullConfigurationFactory>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:36
Type (class name) of provider (instance to be registered and injected).
useExisting?
optional useExisting: Type<SharedBullConfigurationFactory>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:32
Existing Provider to be used.
useFactory()?
optional useFactory: (...args) =>
| QueueOptions
| Promise<QueueOptions>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:40
Factory function that returns an instance of the provider to be injected.
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
| QueueOptions
| Promise<QueueOptions>
SharedBullConfigurationFactory
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:22
Public Api
Methods
createSharedConfiguration()
createSharedConfiguration():
| BullRootModuleOptions
| Promise<BullRootModuleOptions>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/interfaces/shared-bull-config.interface.d.ts:23
Returns
| BullRootModuleOptions
| Promise<BullRootModuleOptions>
Span
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:84
Span interface
Type Parameters
| Type Parameter |
|---|
Context |
Methods
addEvent()
addEvent(name, attributes?): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:112
addEvent adds an event to the span.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | event name |
attributes? | Attributes | event attributes |
Returns
void
end()
end(): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:125
end ends the span.
Note: spans must be ended so that they can be exported.
Returns
void
recordException()
recordException(exception, time?): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:119
recordException records an exception on the span.
Parameters
| Parameter | Type | Description |
|---|---|---|
exception | Exception | exception to record |
time? | Time | time to record the exception |
Returns
void
setAttribute()
setAttribute(key, value): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:99
setAttribute sets an attribute on the span.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | attribute key |
value | AttributeValue | attribute value |
Returns
void
setAttributes()
setAttributes(attributes): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:105
setAttributes sets multiple attributes on the span.
Parameters
| Parameter | Type | Description |
|---|---|---|
attributes | Attributes | attributes to set |
Returns
void
setSpanOnContext()
setSpanOnContext(ctx): Context;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:92
setSpanOnContext sets the span on the context. This is useful when you want to propagate the span across the application.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | context to set the span on |
Returns
Context
- the context with the span set on it
SpanOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:78
Properties
kind
kind: SpanKind;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:79
Telemetry
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:10
Telemetry interface
This interface allows third-party libraries to integrate their own telemetry system. The interface is heavily inspired by OpenTelemetry but it's not limited to it.
Type Parameters
| Type Parameter |
|---|
Context |
Properties
contextManager
contextManager: ContextManager;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:24
Context manager instance
The context manager is responsible for managing the context and propagating it across the application.
tracer
tracer: Tracer<Context>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:17
Tracer instance
The tracer is responsible for creating spans and propagating the context across the application.
Tracer
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:65
Tracer interface
Type Parameters
| Type Parameter |
|---|
Context |
Methods
startSpan()
startSpan(
name,
options?,
context?): Span;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:76
startSpan creates a new Span with the given name and options on an optional context. If the context is not provided, the current active context should be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | span name |
options? | SpanOptions | span options |
context? | Context | optional context |
Returns
- the created span
WorkerListener
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:12
Extends
Type Parameters
| Type Parameter |
|---|
DataType |
ResultType |
NameType extends string |
Properties
active()
active: (job, prev) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:18
Listen to 'active' event.
This event is triggered when a job enters the 'active' state.
Parameters
| Parameter | Type |
|---|---|
job | Job<DataType, ResultType, NameType> |
prev | string |
Returns
void
closed()
closed: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:24
Listen to 'closing' event.
This event is triggered when the worker is closed.
Returns
void
closing()
closing: (msg) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:30
Listen to 'closing' event.
This event is triggered when the worker is closing.
Parameters
| Parameter | Type |
|---|---|
msg | string |
Returns
void
completed()
completed: (job, result, prev) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:36
Listen to 'completed' event.
This event is triggered when a job has successfully completed.
Parameters
| Parameter | Type |
|---|---|
job | Job<DataType, ResultType, NameType> |
result | ResultType |
prev | string |
Returns
void
drained()
drained: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:44
Listen to 'drained' event.
This event is triggered when the queue has drained the waiting list. Note that there could still be delayed jobs waiting their timers to expire and this event will still be triggered as long as the waiting list has emptied.
Returns
void
error()
error: (failedReason) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:50
Listen to 'error' event.
This event is triggered when an error is throw.
Parameters
| Parameter | Type |
|---|---|
failedReason | Error |
Returns
void
failed()
failed: (job, error, prev) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:58
Listen to 'failed' event.
This event is triggered when a job has thrown an exception. Note: job parameter could be received as undefined when an stalled job reaches the stalled limit and it is deleted by the removeOnFail option.
Parameters
| Parameter | Type |
|---|---|
job | Job<DataType, ResultType, NameType> | undefined |
error | Error |
prev | string |
Returns
void
ioredis:close()
ioredis:close: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/ioredis-events.d.ts:7
Listen to 'ioredis:close' event.
This event is triggered when ioredis is closed.
Returns
void
Inherited from
lockRenewalFailed()
lockRenewalFailed: (jobIds) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:98
Listen to 'lockRenewalFailed' event.
This event is triggered when lock renewal fails for one or more jobs.
Parameters
| Parameter | Type |
|---|---|
jobIds | string[] |
Returns
void
locksRenewed()
locksRenewed: (data) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:104
Listen to 'locksRenewed' event.
This event is triggered when locks are successfully renewed.
Parameters
| Parameter | Type |
|---|---|
data | { count: number; jobIds: string[]; } |
data.count | number |
data.jobIds | string[] |
Returns
void
paused()
paused: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:64
Listen to 'paused' event.
This event is triggered when the queue is paused.
Returns
void
progress()
progress: (job, progress) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:73
Listen to 'progress' event.
This event is triggered when a job updates it progress, i.e. the Job##updateProgress() method is called. This is useful to notify progress or any other data from within a processor to the rest of the world.
Parameters
| Parameter | Type |
|---|---|
job | Job<DataType, ResultType, NameType> |
progress | JobProgress |
Returns
void
ready()
ready: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:79
Listen to 'ready' event.
This event is triggered when blockingConnection is ready.
Returns
void
resumed()
resumed: () => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:85
Listen to 'resumed' event.
This event is triggered when the queue is resumed.
Returns
void
stalled()
stalled: (jobId, prev) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/worker.d.ts:92
Listen to 'stalled' event.
This event is triggered when a job has stalled and has been moved back to the wait list.
Parameters
| Parameter | Type |
|---|---|
jobId | string |
prev | string |
Returns
void
WorkerOptions
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:8
Base Queue options
Extends
Properties
autorun?
optional autorun: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:20
Condition to start processor at instance creation.
Default Value
true
blockingConnection?
optional blockingConnection: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:21
Denotes commands should retry indefinitely.
Deprecated
not in use anymore.
Inherited from
QueueBaseOptions.blockingConnection
concurrency?
optional concurrency: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:28
Amount of jobs that a single worker is allowed to work on in parallel.
Default Value
1
See
https://docs.bullmq.io/guide/workers/concurrency
connection
connection: ConnectionOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:16
Options for connecting to a Redis instance.
Inherited from
drainDelay?
optional drainDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:101
Number of seconds to long poll for jobs when the queue is empty.
Default Value
5
limiter?
optional limiter: RateLimiterOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:33
Enable rate limiter
See
https://docs.bullmq.io/guide/rate-limiting
lockDuration?
optional lockDuration: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:110
Duration of the lock for the job in milliseconds. The lock represents that a worker is processing the job. If the lock is lost, the job will be eventually be picked up by the stalled checker and move back to wait so that another worker can process it again.
Default Value
30000
lockRenewTime?
optional lockRenewTime: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:117
The time in milliseconds before the lock is automatically renewed.
It is not recommended to modify this value, which is by default set to halv the lockDuration value, which is optimal for most use cases.
maximumRateLimitDelay?
optional maximumRateLimitDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:45
Maximum time in milliseconds where the job is idle while being rate limited. While workers are idle because of a rate limiter, they won't fetch new jobs to process and delayed jobs won't be promoted.
Default Value
30000
maxStalledCount?
optional maxStalledCount: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:61
Amount of times a job can be recovered from a stalled state
to the wait state. If this is exceeded, the job is moved
to failed.
Default Value
1
maxStartedAttempts?
optional maxStartedAttempts: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:53
Defines the maximum number of times a job is allowed to start processing, regardless of whether it completes or fails. Each time a worker picks up the job and begins processing it, the attemptsStarted counter is incremented. If this counter reaches maxStartedAttempts, the job will be moved to the failed state with an UnrecoverableError.
Default Value
undefined
metrics?
optional metrics: MetricsOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:38
Enable collect metrics.
See
https://docs.bullmq.io/guide/metrics
name?
optional name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:14
Optional worker name. The name will be stored on every job processed by this worker instance, and can be used to monitor which worker is processing or has processed a given job.
prefix?
optional prefix: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:25
Prefix for all queue keys.
Inherited from
removeOnComplete?
optional removeOnComplete: KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:73
You can provide an object specifying max age and/or count to keep. Default behavior is to keep the job in the completed set.
removeOnFail?
optional removeOnFail: KeepJobs;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:79
You can provide an object specifying max age and/or count to keep. Default behavior is to keep the job in the failed set.
runRetryDelay?
optional runRetryDelay: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:123
This is an internal option that should not be modified.
Default Value
15000
settings?
optional settings: AdvancedOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:127
More advanced options.
skipLockRenewal?
optional skipLockRenewal: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:95
Skip lock renewal for this worker. If set to true, the lock will expire after lockDuration and moved back to the wait queue (if the stalled check is not disabled)
Default Value
false
skipStalledCheck?
optional skipStalledCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:87
Skip stalled check for this worker. Note that other workers could still perform stalled checkd and move jobs back to wait for jobs being processed by this worker.
Default Value
false
skipVersionCheck?
optional skipVersionCheck: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:30
Avoid version validation to be greater or equal than v5.0.0.
Default Value
false
Inherited from
QueueBaseOptions.skipVersionCheck
skipWaitingForReady?
optional skipWaitingForReady: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:43
Skip waiting for connection ready.
In some instances if you want the queue to fail fast if the connection is not ready you can set this to true. This could be useful for testing and when adding jobs via HTTP endpoints for example.
Inherited from
QueueBaseOptions.skipWaitingForReady
stalledInterval?
optional stalledInterval: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:67
Number of milliseconds between stallness checks.
Default Value
30000
telemetry?
optional telemetry: Telemetry<any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:139
Telemetry Addon
Overrides
useWorkerThreads?
optional useWorkerThreads: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:135
Use Worker Threads instead of Child Processes. Note: This option can only be used when specifying a file for the processor argument.
Default Value
false
Overrides
SandboxedOptions.useWorkerThreads
workerForkOptions?
optional workerForkOptions: ForkOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:18
Support passing Worker Fork Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as false (default value).
See
https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options
Inherited from
SandboxedOptions.workerForkOptions
workerThreadsOptions?
optional workerThreadsOptions: WorkerOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts:25
Support passing Worker Threads Options. Note: This option can only be used when specifying a file for the processor argument and useWorkerThreads is passed as true.
See
https://nodejs.org/api/worker_threads.html#new-workerfilename-options
Inherited from
SandboxedOptions.workerThreadsOptions
Type Aliases
AttributeValue
type AttributeValue =
| string
| number
| boolean
| (null | undefined | string)[]
| (null | undefined | number)[]
| (null | undefined | boolean)[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:130
BackoffStrategy()
type BackoffStrategy = (attemptsMade, type?, err?, job?) => Promise<number> | number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/backoff-strategy.d.ts:2
Parameters
| Parameter | Type |
|---|---|
attemptsMade | number |
type? | string |
err? | Error |
job? | MinimalJob |
Returns
Promise<number> | number
BulkJobOptions
type BulkJobOptions = Omit<JobsOptions, "repeat">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts:7
BullQueueProcessor
type BullQueueProcessor =
| BullQueueProcessorCallback
| BullQueueAdvancedProcessor
| BullQueueSeparateProcessor
| BullQueueAdvancedSeparateProcessor;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/bull.types.d.ts:4
BullQueueProcessorCallback()
type BullQueueProcessorCallback = (job) => Promise<unknown>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/bull.types.d.ts:5
Parameters
| Parameter | Type |
|---|---|
job | Job |
Returns
Promise<unknown>
BullQueueSeparateProcessor
type BullQueueSeparateProcessor = string | URL;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/bull.types.d.ts:6
ClusterOptions
type ClusterOptions = IORedis.ClusterOptions & BaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-options.d.ts:7
CompressableJobOptions
type CompressableJobOptions = {
continueParentOnFailure?: boolean;
debounce?: DeduplicationOptions;
deduplication?: DeduplicationOptions;
failParentOnFailure?: boolean;
ignoreDependencyOnFailure?: boolean;
removeDependencyOnFailure?: boolean;
telemetry?: {
metadata?: string;
omitContext?: boolean;
};
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:7
These options will be stored in Redis with smaller keys for compactness.
Properties
continueParentOnFailure?
optional continueParentOnFailure: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:26
If true, starts processing parent job as soon as any of its children fail.
debounce?
optional debounce: DeduplicationOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:12
Debounce options.
Deprecated
use deduplication option
deduplication?
optional deduplication: DeduplicationOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:16
Deduplication options.
failParentOnFailure?
optional failParentOnFailure: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:20
If true, moves parent to failed if any of its children fail.
ignoreDependencyOnFailure?
optional ignoreDependencyOnFailure: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:30
If true, moves the jobId from its parent dependencies to failed dependencies when it fails after all attempts.
removeDependencyOnFailure?
optional removeDependencyOnFailure: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:34
If true, removes the job from its parent dependencies when it fails after all attempts.
telemetry?
optional telemetry: {
metadata?: string;
omitContext?: boolean;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:38
Telemetry options
metadata?
optional metadata: string;
Metadata, used for context propagation.
omitContext?
optional omitContext: boolean;
If true telemetry will omit the context propagation
Default Value
false
ConnectionOptions
type ConnectionOptions =
| RedisOptions
| ClusterOptions
| IORedis.Redis
| IORedis.Cluster;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-options.d.ts:8
DeduplicationOptions
type DeduplicationOptions = {
id: string;
} & {
extend?: boolean;
replace?: boolean;
ttl?: number;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/deduplication-options.d.ts:4
Deduplication options
Type Declaration
id
id: string;
Identifier
Type Declaration
extend?
optional extend: boolean;
Extend ttl value
replace?
optional replace: boolean;
replace job record while it's in delayed state
ttl?
optional ttl: number;
ttl in milliseconds
EntryId
type EntryId = string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-streams.d.ts:2
EntryRaw
type EntryRaw = [EntryId, string[]];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-streams.d.ts:3
Exception
type Exception = string | ExceptionType;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:131
ExceptionType
type ExceptionType = CodeException | MessageException | NameException;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:132
FinishedPropValAttribute
type FinishedPropValAttribute = "returnvalue" | "failedReason";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/finished-status.d.ts:2
FinishedStatus
type FinishedStatus = "completed" | "failed";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/finished-status.d.ts:1
FlowChildJob
type FlowChildJob = FlowJobBase<Omit<JobsOptions, "parent">>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:11
FlowJob
type FlowJob = FlowJobBase<JobsOptions>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:12
FlowQueuesOpts
type FlowQueuesOpts = Record<string, Omit<QueueOptions, "connection" | "prefix">>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts:13
JobData
type JobData = [JobJsonRaw | number, string?];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:7
JobJsonSandbox
type JobJsonSandbox = JobJson & {
prefix: string;
queueName: string;
queueQualifiedName: string;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-json-sandbox.d.ts:2
Type Declaration
prefix
prefix: string;
queueName
queueName: string;
queueQualifiedName
queueQualifiedName: string;
JobProgress
type JobProgress = string | boolean | number | object;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-progress.d.ts:1
JobSchedulerTemplateOptions
type JobSchedulerTemplateOptions = Omit<JobsOptions, "jobId" | "repeat" | "delay" | "deduplication" | "debounce">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-scheduler-template-options.d.ts:2
JobsOptions
type JobsOptions = BaseJobOptions & CompressableJobOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:50
JobState
type JobState =
| FinishedStatus
| "active"
| "delayed"
| "prioritized"
| "waiting"
| "waiting-children";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-type.d.ts:2
JobType
type JobType = JobState | "paused" | "repeat" | "wait";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-type.d.ts:3
KeysMap
type KeysMap = { [index in string]: string };
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts:1
ParentKeyOpts
type ParentKeyOpts = {
addToWaitingChildren?: boolean;
parentDependenciesKey?: string;
parentKey?: string;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:20
Properties
addToWaitingChildren?
optional addToWaitingChildren: boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:21
parentDependenciesKey?
optional parentDependenciesKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:22
parentKey?
optional parentKey: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/parent.d.ts:23
QueueEventsListenerOptions
type QueueEventsListenerOptions = {
queueEventsOptions?: NestQueueEventOptions;
queueName: string;
};
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/queue-events-listener.decorator.d.ts:2
Properties
queueEventsOptions?
optional queueEventsOptions: NestQueueEventOptions;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/queue-events-listener.decorator.d.ts:4
queueName
queueName: string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/queue-events-listener.decorator.d.ts:3
QueueEventsProducerOptions
type QueueEventsProducerOptions = Omit<QueueBaseOptions, "telemetry">;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts:106
Options for QueueEventsProducer
RedisClient
type RedisClient = Redis | Cluster;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/connection.d.ts:3
RedisJobOptions
type RedisJobOptions = BaseJobOptions & {
cpof?: boolean;
de?: DeduplicationOptions;
deid?: string;
fpof?: boolean;
idof?: boolean;
kl?: number;
omc?: boolean;
rdof?: boolean;
tm?: string;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/job-options.d.ts:54
These fields are the ones stored in Redis with smaller keys for compactness.
Type Declaration
cpof?
optional cpof: boolean;
If true, starts processing parent job as soon as any of its children fail.
de?
optional de: DeduplicationOptions;
Deduplication options.
deid?
optional deid: string;
Debounce identifier.
fpof?
optional fpof: boolean;
If true, moves parent to failed.
idof?
optional idof: boolean;
If true, moves the jobId from its parent dependencies to failed dependencies when it fails after all attempts.
kl?
optional kl: number;
Maximum amount of log entries that will be preserved
omc?
optional omc: boolean;
Omit Context Propagation
rdof?
optional rdof: boolean;
If true, removes the job from its parent dependencies when it fails after all attempts.
tm?
optional tm: string;
TelemetryMetadata, provide for context propagation.
RedisOptions
type RedisOptions = IORedis.RedisOptions & BaseOptions;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-options.d.ts:6
RepeatableJob
type RepeatableJob = {
endDate: number | null;
every?: string | null;
id?: string | null;
key: string;
name: string;
next?: number;
pattern: string | null;
tz: string | null;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:1
Properties
endDate
endDate: number | null;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:5
every?
optional every: string | null;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:8
id?
optional id: string | null;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:4
key
key: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:2
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:3
next?
optional next: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:9
pattern
pattern: string | null;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:7
tz
tz: string | null;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts:6
RepeatableOptions
type RepeatableOptions = {
endDate?: number;
every?: number;
limit?: number;
name: string;
offset?: number;
pattern?: string;
startDate?: number;
tz?: string;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:1
Properties
endDate?
optional endDate: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:4
every?
optional every: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:8
limit?
optional limit: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:6
name
name: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:2
offset?
optional offset: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:9
pattern?
optional pattern: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:7
startDate?
optional startDate: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:3
tz?
optional tz: string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts:5
RepeatStrategy()
type RepeatStrategy = (millis, opts, name?) => number | undefined | Promise<number | undefined>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/types/repeat-strategy.d.ts:2
Parameters
| Parameter | Type |
|---|---|
millis | number |
opts | RepeatOptions |
name? | string |
Returns
number | undefined | Promise<number | undefined>
SandboxedJobProcessor
type SandboxedJobProcessor<T, R> = (job) => R | PromiseLike<R> | (job, callback) => void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/sandboxed-job-processor.d.ts:5
Type Parameters
| Type Parameter |
|---|
T |
R |
See
https://docs.bullmq.io/guide/workers/sandboxed-processors
StreamName
type StreamName = string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-streams.d.ts:1
StreamReadRaw
type StreamReadRaw =
| [StreamName, EntryRaw[]][]
| null
| undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/redis-streams.d.ts:4
Time
type Time = HighResolutionTime | number | Date;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts:151
Variables
asyncSend()
const asyncSend: <T>(proc, msg) => Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:57
Type Parameters
| Type Parameter |
|---|
T extends procSendLike |
Parameters
| Parameter | Type |
|---|---|
proc | T |
msg | any |
Returns
Promise<void>
BULL_CONFIG_DEFAULT_TOKEN
const BULL_CONFIG_DEFAULT_TOKEN: "BULLMQ_CONFIG(default)" = "BULLMQ_CONFIG(default)";
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/utils/get-shared-config-token.util.d.ts:1
childSend()
const childSend: (proc, msg) => Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:58
Parameters
| Parameter | Type |
|---|---|
proc | NodeJS.Process |
msg | ChildMessage |
Returns
Promise<void>
clientCommandMessageReg
const clientCommandMessageReg: RegExp;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:49
createScripts()
const createScripts: (queue) => Scripts;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/create-scripts.d.ts:3
Parameters
| Parameter | Type |
|---|---|
queue | MinimalQueue |
Returns
defaultRepeatStrategy()
const defaultRepeatStrategy: (millis, opts) => number | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts:24
Parameters
| Parameter | Type |
|---|---|
millis | number |
opts | RepeatOptions |
Returns
number | undefined
DELAY_TIME_1
const DELAY_TIME_1: 100 = 100;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:51
DELAY_TIME_5
const DELAY_TIME_5: 5000 = 5000;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:50
DELAYED_ERROR
const DELAYED_ERROR: "bullmq:movedToDelayed" = "bullmq:movedToDelayed";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/delayed-error.d.ts:1
errorObject
const errorObject: {
[index: string]: any;
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:6
Index Signature
[index: string]: any
errorToJSON()
const errorToJSON: (value) => Record<string, any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:63
Parameters
| Parameter | Type |
|---|---|
value | any |
Returns
Record<string, any>
getNextMillis()
const getNextMillis: (millis, opts) => number | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/repeat.d.ts:25
Parameters
| Parameter | Type |
|---|---|
millis | number |
opts | RepeatOptions |
Returns
number | undefined
InjectFlowProducer()
const InjectFlowProducer: (name?) => ReturnType<typeof Inject>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/inject-flow-producer.decorator.d.ts:8
Injects Bull's flow producer instance with the given name
Parameters
| Parameter | Type | Description |
|---|---|---|
name? | string | flow producer name |
Returns
ReturnType<typeof Inject>
Public Api
InjectQueue()
const InjectQueue: (name?) => ReturnType<typeof Inject>;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/inject-queue.decorator.d.ts:8
Injects Bull's queue instance with the given name
Parameters
| Parameter | Type | Description |
|---|---|---|
name? | string | queue name |
Returns
ReturnType<typeof Inject>
Public Api
isRedisVersionLowerThan()
const isRedisVersionLowerThan: (currentVersion, minimumVersion) => boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:59
Parameters
| Parameter | Type |
|---|---|
currentVersion | string |
minimumVersion | string |
Returns
boolean
JOB_REF
const JOB_REF: "REQUEST" = "REQUEST";
Defined in: node_modules/.pnpm/@nestjs+bull-shared@11.0.4/node_modules/@nestjs/bull-shared/dist/bull.tokens.d.ts:1
OnQueueEvent()
const OnQueueEvent: (eventName) => MethodDecorator;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/on-queue-event.decorator.d.ts:15
Registers a queue event listener. Class that contains queue event listeners must be annotated with the "QueueEventsListener" decorator.
Parameters
| Parameter | Type |
|---|---|
eventName | keyof QueueEventsListener |
Returns
MethodDecorator
Public Api
OnWorkerEvent()
const OnWorkerEvent: (eventName) => MethodDecorator;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/on-worker-event.decorator.d.ts:15
Registers a worker event listener. Class that contains worker event listeners must be annotated with the "Processor" decorator.
Parameters
| Parameter | Type |
|---|---|
eventName | keyof WorkerListener |
Returns
MethodDecorator
Public Api
optsDecodeMap
const optsDecodeMap: {
cpof: "continueParentOnFailure";
de: "deduplication";
fpof: "failParentOnFailure";
idof: "ignoreDependencyOnFailure";
kl: "keepLogs";
rdof: "removeDependencyOnFailure";
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:27
Type Declaration
cpof
readonly cpof: "continueParentOnFailure";
de
readonly de: "deduplication";
fpof
readonly fpof: "failParentOnFailure";
idof
readonly idof: "ignoreDependencyOnFailure";
kl
readonly kl: "keepLogs";
rdof
readonly rdof: "removeDependencyOnFailure";
optsEncodeMap
const optsEncodeMap: {
continueParentOnFailure: "cpof";
debounce: "de";
deduplication: "de";
failParentOnFailure: "fpof";
ignoreDependencyOnFailure: "idof";
keepLogs: "kl";
removeDependencyOnFailure: "rdof";
};
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:35
Type Declaration
continueParentOnFailure
readonly continueParentOnFailure: "cpof";
debounce
readonly debounce: "de";
deduplication
readonly deduplication: "de";
failParentOnFailure
readonly failParentOnFailure: "fpof";
ignoreDependencyOnFailure
readonly ignoreDependencyOnFailure: "idof";
keepLogs
readonly keepLogs: "kl";
removeDependencyOnFailure
readonly removeDependencyOnFailure: "rdof";
parseObjectValues()
const parseObjectValues: (obj) => Record<string, any>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:60
Parameters
| Parameter | Type |
|---|---|
obj | { [key: string]: string; } |
Returns
Record<string, any>
PRIORITY_LIMIT
const PRIORITY_LIMIT: number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/job.d.ts:5
QUEUE_EVENT_SUFFIX
const QUEUE_EVENT_SUFFIX: ":qe" = ":qe";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:65
RATE_LIMIT_ERROR
const RATE_LIMIT_ERROR: "bullmq:rateLimitExceeded" = "bullmq:rateLimitExceeded";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/rate-limit-error.d.ts:1
toString()
const toString: (value) => string;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:64
Parameters
| Parameter | Type |
|---|---|
value | any |
Returns
string
UNRECOVERABLE_ERROR
const UNRECOVERABLE_ERROR: "bullmq:unrecoverable" = "bullmq:unrecoverable";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/unrecoverable-error.d.ts:1
WAITING_CHILDREN_ERROR
const WAITING_CHILDREN_ERROR: "bullmq:movedToWaitingChildren" = "bullmq:movedToWaitingChildren";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/waiting-children-error.d.ts:1
WAITING_ERROR
const WAITING_ERROR: "bullmq:movedToWait" = "bullmq:movedToWait";
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/errors/waiting-error.d.ts:1
Functions
array2obj()
function array2obj(arr): Record<string, string>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:17
Parameters
| Parameter | Type |
|---|---|
arr | string[] |
Returns
Record<string, string>
decreaseMaxListeners()
function decreaseMaxListeners(emitter, count): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:46
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
count | number |
Returns
void
delay()
function delay(ms, abortController?): Promise<void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:19
Parameters
| Parameter | Type |
|---|---|
ms | number |
abortController? | AbortController |
Returns
Promise<void>
getFlowProducerOptionsToken()
function getFlowProducerOptionsToken(name?): string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/utils/get-flow-producer-options-token.util.d.ts:1
Parameters
| Parameter | Type |
|---|---|
name? | string |
Returns
string
getFlowProducerToken()
function getFlowProducerToken(name?): string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/utils/get-flow-producer-token.util.d.ts:1
Parameters
| Parameter | Type |
|---|---|
name? | string |
Returns
string
getParentKey()
function getParentKey(opts): string | undefined;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:48
Parameters
| Parameter | Type |
|---|---|
opts | ParentOptions |
Returns
string | undefined
getQueueOptionsToken()
function getQueueOptionsToken(name?): string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/utils/get-queue-options-token.util.d.ts:1
Parameters
| Parameter | Type |
|---|---|
name? | string |
Returns
string
getQueueToken()
function getQueueToken(name?): string;
Defined in: node_modules/.pnpm/@nestjs+bull-shared@11.0.4/node_modules/@nestjs/bull-shared/dist/utils/get-queue-token.util.d.ts:1
Parameters
| Parameter | Type |
|---|---|
name? | string |
Returns
string
getSharedConfigToken()
function getSharedConfigToken(configKey?): string;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/utils/get-shared-config-token.util.d.ts:2
Parameters
| Parameter | Type |
|---|---|
configKey? | string |
Returns
string
increaseMaxListeners()
function increaseMaxListeners(emitter, count): void;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:20
Parameters
| Parameter | Type |
|---|---|
emitter | EventEmitter |
count | number |
Returns
void
invertObject()
function invertObject<T>(obj): Invert<T>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:26
Type Parameters
| Type Parameter |
|---|
T extends Record<PropertyKey, PropertyKey> |
Parameters
| Parameter | Type |
|---|---|
obj | T |
Returns
Invert<T>
isEmpty()
function isEmpty(obj): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:16
Parameters
| Parameter | Type |
|---|---|
obj | object |
Returns
boolean
isNotConnectionError()
function isNotConnectionError(error): boolean;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:52
Parameters
| Parameter | Type |
|---|---|
error | Error |
Returns
boolean
isRedisCluster()
function isRedisCluster(obj): obj is Cluster;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:45
Parameters
| Parameter | Type |
|---|---|
obj | unknown |
Returns
obj is Cluster
isRedisInstance()
function isRedisInstance(obj): obj is Redis | Cluster;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:44
Parameters
| Parameter | Type |
|---|---|
obj | any |
Returns
obj is Redis | Cluster
lengthInUtf8Bytes()
function lengthInUtf8Bytes(str): number;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:15
Checks the size of string for ascii/non-ascii characters
Parameters
| Parameter | Type |
|---|---|
str | string |
Returns
number
See
https://stackoverflow.com/a/23318053/1347170
objectToFlatArray()
function objectToFlatArray(obj): string[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:18
Parameters
| Parameter | Type |
|---|---|
obj | Record<string, any> |
Returns
string[]
Processor()
Call Signature
function Processor(queueName): ClassDecorator;
Defined in: packages/bullmq/src/processor.decorator.ts:14
Parameters
| Parameter | Type |
|---|---|
queueName | string |
Returns
ClassDecorator
Call Signature
function Processor(queueName, workerOptions): ClassDecorator;
Defined in: packages/bullmq/src/processor.decorator.ts:16
Parameters
| Parameter | Type |
|---|---|
queueName | string |
workerOptions | NestWorkerOptions |
Returns
ClassDecorator
Call Signature
function Processor(processorOptions): ClassDecorator;
Defined in: packages/bullmq/src/processor.decorator.ts:21
Parameters
| Parameter | Type |
|---|---|
processorOptions | ProcessorOptions |
Returns
ClassDecorator
Call Signature
function Processor(processorOptions, workerOptions): ClassDecorator;
Defined in: packages/bullmq/src/processor.decorator.ts:23
Parameters
| Parameter | Type |
|---|---|
processorOptions | ProcessorOptions |
workerOptions | NestWorkerOptions |
Returns
ClassDecorator
QueueEventsListener()
function QueueEventsListener(queueName, queueEventsOptions?): ClassDecorator;
Defined in: node_modules/.pnpm/@nestjs+bullmq@11.0.4/node_modules/@nestjs/bullmq/dist/decorators/queue-events-listener.decorator.d.ts:11
Represents a "QueueEvents" component (class that reacts to queue events).
Parameters
| Parameter | Type |
|---|---|
queueName | string |
queueEventsOptions? | NestQueueEventOptions |
Returns
ClassDecorator
Public Api
raw2NextJobData()
function raw2NextJobData(raw): any[];
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/classes/scripts.d.ts:183
Parameters
| Parameter | Type |
|---|---|
raw | any[] |
Returns
any[]
removeAllQueueData()
function removeAllQueueData(
client,
queueName,
prefix?): Promise<boolean | void>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:47
Parameters
| Parameter | Type |
|---|---|
client | RedisClient |
queueName | string |
prefix? | string |
Returns
Promise<boolean | void>
removeUndefinedFields()
function removeUndefinedFields<T>(obj): T;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:66
Type Parameters
| Type Parameter |
|---|
T extends Record<string, any> |
Parameters
| Parameter | Type |
|---|---|
obj | Record<string, any> |
Returns
T
trace()
function trace<T>(
telemetry,
spanKind,
queueName,
operation,
destination,
callback,
srcPropagationMetadata?): Promise<T>;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:79
Wraps the code with telemetry and provides a span for configuration.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
telemetry | | { contextManager: ContextManager; tracer: Tracer; } | undefined | telemetry configuration. If undefined, the callback will be executed without telemetry. |
spanKind | SpanKind | kind of the span: Producer, Consumer, Internal |
queueName | string | queue name |
operation | string | operation name (such as add, process, etc) |
destination | string | destination name (normally the queue name) |
callback | (span?, dstPropagationMetadata?) => T | Promise<T> | code to wrap with telemetry |
srcPropagationMetadata? | string | - |
Returns
Promise<T>
tryCatch()
function tryCatch(
fn,
ctx,
args): any;
Defined in: node_modules/.pnpm/bullmq@5.66.1/node_modules/bullmq/dist/esm/utils/index.d.ts:9
Parameters
| Parameter | Type |
|---|---|
fn | (...args) => any |
ctx | any |
args | any[] |
Returns
any