@types/bull

  • Version 3.15.9
  • Published
  • 39.2 kB
  • 2 dependencies
  • MIT license

Install

npm i @types/bull
yarn add @types/bull
pnpm add @types/bull

Overview

TypeScript definitions for bull

Index

Variables

Interfaces

Type Aliases

Variables

variable Bull

const Bull: {
<T = any>(queueName: string, opts?: Bull.QueueOptions): Bull.Queue<T>;
<T = any>(
queueName: string,
url: string,
opts?: Bull.QueueOptions
): Bull.Queue<T>;
new <T = any>(queueName: string, opts?: Bull.QueueOptions): Bull.Queue<T>;
new <T = any>(
queueName: string,
url: string,
opts?: Bull.QueueOptions
): Bull.Queue<T>;
};
  • This is the Queue constructor. It creates a new Queue that is persisted in Redis. Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session.

Interfaces

interface AdvancedSettings

interface AdvancedSettings {}

    property backoffStrategies

    backoffStrategies?:
    | {
    [key: string]: (
    attemptsMade: number,
    err: Error,
    strategyOptions?: any
    ) => number;
    }
    | undefined;
    • Define a custom backoff strategy

    property drainDelay

    drainDelay?: number | undefined;
    • A timeout for when the queue is in drained state (empty waiting for jobs). It is used when calling queue.getNextJob(), which will pass it to .brpoplpush on the Redis client.

    property guardInterval

    guardInterval?: number | undefined;
    • Poll interval for delayed jobs and added jobs

    property lockDuration

    lockDuration?: number | undefined;
    • Key expiration time for job locks

    property lockRenewTime

    lockRenewTime?: number | undefined;
    • Interval in milliseconds on which to acquire the job lock.

    property maxStalledCount

    maxStalledCount?: number | undefined;
    • Max amount of times a stalled job will be re-processed

    property retryProcessDelay

    retryProcessDelay?: number | undefined;
    • Delay before processing next job in case of internal error

    property stalledInterval

    stalledInterval?: number | undefined;
    • How often check for stalled jobs (use 0 for never checking)

    interface BackoffOptions

    interface BackoffOptions {}

      property delay

      delay?: number | undefined;
      • Backoff delay, in milliseconds

      property strategyOptions

      strategyOptions?: any;
      • Options for custom strategies

      property type

      type: string;
      • Backoff type, which can be either fixed or exponential

      interface CronRepeatOptions

      interface CronRepeatOptions extends RepeatOptions {}

        property cron

        cron: string;
        • Cron pattern specifying when the job should execute

        property startDate

        startDate?: Date | string | number | undefined;
        • Start date when the repeat job should start repeating (only with cron).

        interface EveryRepeatOptions

        interface EveryRepeatOptions extends RepeatOptions {}

          property every

          every: number;
          • Repeat every millis (cron setting cannot be used together with this setting.)

          interface Job

          interface Job<T = any> {}

            property attemptsMade

            attemptsMade: number;
            • How many attempts where made to run this job

            property data

            data: T;
            • The custom data passed when the job was created

            property failedReason

            failedReason?: string | undefined;

              property finishedOn

              finishedOn?: number | undefined;
              • When this job was completed (unix milliseconds)

              property id

              id: JobId;

                property name

                name: string;
                • The named processor name

                property opts

                opts: JobOptions;
                • Options of the job

                property processedOn

                processedOn?: number | undefined;
                • When this job was started (unix milliseconds)

                property queue

                queue: Queue<T>;
                • Which queue this job was part of

                property returnvalue

                returnvalue: any;

                  property stacktrace

                  stacktrace: string[];
                  • The stacktrace for any errors

                  property timestamp

                  timestamp: number;

                    method discard

                    discard: () => Promise<void>;
                    • Ensure this job is never ran again even if attemptsMade is less than job.attempts.

                    method finished

                    finished: () => Promise<any>;
                    • Returns a promise that resolves to the returned data when the job has been finished. TODO: Add a watchdog to check if the job has finished periodically. since pubsub does not give any guarantees.

                    method getState

                    getState: () => Promise<JobStatus | 'stuck'>;
                    • Returns a promise resolving to the current job's status. Please take note that the implementation of this method is not very efficient, nor is it atomic. If your queue does have a very large quantity of jobs, you may want to avoid using this method.

                    method isActive

                    isActive: () => Promise<boolean>;
                    • Returns a promise resolving to a boolean which, if true, current job's state is active

                    method isCompleted

                    isCompleted: () => Promise<boolean>;
                    • Returns a promise resolving to a boolean which, if true, current job's state is completed

                    method isDelayed

                    isDelayed: () => Promise<boolean>;
                    • Returns a promise resolving to a boolean which, if true, current job's state is delayed

                    method isFailed

                    isFailed: () => Promise<boolean>;
                    • Returns a promise resolving to a boolean which, if true, current job's state is failed

                    method isPaused

                    isPaused: () => Promise<boolean>;
                    • Returns a promise resolving to a boolean which, if true, current job's state is paused

                    method isStuck

                    isStuck: () => Promise<boolean>;
                    • Returns a promise resolving to a boolean which, if true, current job's state is stuck

                    method isWaiting

                    isWaiting: () => Promise<boolean>;
                    • Returns a promise resolving to a boolean which, if true, current job's state is wait

                    method lockKey

                    lockKey: () => string;
                    • The lock id of the job

                    method log

                    log: (row: string) => Promise<any>;
                    • Logs one row of log data.

                      Parameter row

                      String with log data to be logged.

                    method moveToCompleted

                    moveToCompleted: (
                    returnValue?: string,
                    ignoreLock?: boolean,
                    notFetch?: boolean
                    ) => Promise<[any, JobId] | null>;
                    • Moves a job to the completed queue. Pulls a job from 'waiting' to 'active' and returns a tuple containing the next jobs data and id. If no job is in the waiting queue, returns null.

                    method moveToFailed

                    moveToFailed: (
                    errorInfo: { message: string },
                    ignoreLock?: boolean
                    ) => Promise<[any, JobId] | null>;
                    • Moves a job to the failed queue. Pulls a job from 'waiting' to 'active' and returns a tuple containing the next jobs data and id. If no job is in the waiting queue, returns null.

                    method progress

                    progress: { (): any; (value: any): Promise<void> };
                    • Get progress on a job

                    • Report progress on a job

                    method promote

                    promote: () => Promise<void>;
                    • Promotes a job that is currently "delayed" to the "waiting" state and executed as soon as possible.

                    method releaseLock

                    releaseLock: () => Promise<void>;
                    • Releases the lock on the job. Only locks owned by the queue instance can be released.

                    method remove

                    remove: () => Promise<void>;
                    • Removes a job from the queue and from any lists it may be included in. The returned promise resolves when the job has been removed.

                    method retry

                    retry: () => Promise<void>;
                    • Re-run a job that has failed. The returned promise resolves when the job has been scheduled for retry.

                    method takeLock

                    takeLock: () => Promise<number | false>;
                    • Takes a lock for this job so that no other queue worker can process it at the same time.

                    method toJSON

                    toJSON: () => {
                    id: JobId;
                    name: string;
                    data: T;
                    opts: JobOptions;
                    progress: number;
                    delay: number;
                    timestamp: number;
                    attemptsMade: number;
                    failedReason: any;
                    stacktrace: string[] | null;
                    returnvalue: any;
                    finishedOn: number | null;
                    processedOn: number | null;
                    };
                    • Get job properties as Json Object

                    method update

                    update: (data: T) => Promise<void>;
                    • Update a specific job's data. Promise resolves when the job has been updated.

                    interface JobCounts

                    interface JobCounts {}

                      property active

                      active: number;

                        property completed

                        completed: number;

                          property delayed

                          delayed: number;

                            property failed

                            failed: number;

                              property waiting

                              waiting: number;

                                interface JobInformation

                                interface JobInformation {}

                                  property cron

                                  cron: string;

                                    property endDate

                                    endDate?: number | undefined;

                                      property every

                                      every: number;

                                        property id

                                        id?: string | undefined;

                                          property key

                                          key: string;

                                            property name

                                            name: string;

                                              property next

                                              next: number;

                                                property tz

                                                tz?: string | undefined;

                                                  interface JobOptions

                                                  interface JobOptions {}

                                                    property attempts

                                                    attempts?: number | undefined;
                                                    • The total number of attempts to try the job until it completes

                                                    property backoff

                                                    backoff?: number | BackoffOptions | undefined;
                                                    • Backoff setting for automatic retries if the job fails

                                                    property delay

                                                    delay?: number | undefined;
                                                    • An amount of miliseconds to wait until this job can be processed. Note that for accurate delays, both server and clients should have their clocks synchronized. [optional]

                                                    property jobId

                                                    jobId?: JobId | undefined;
                                                    • 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.

                                                    property lifo

                                                    lifo?: boolean | undefined;
                                                    • A boolean which, if true, adds the job to the right of the queue instead of the left (default false)

                                                    property preventParsingData

                                                    preventParsingData?: boolean | undefined;
                                                    • Prevents JSON data from being parsed.

                                                    property priority

                                                    priority?: number | undefined;
                                                    • Optional priority value. ranges from 1 (highest priority) to MAX_INT (lowest priority). Note that using priorities has a slight impact on performance, so do not use it if not required

                                                    property removeOnComplete

                                                    removeOnComplete?: boolean | number | KeepJobsOptions | undefined;
                                                    • A boolean which, if true, removes the job when it successfully completes. When a number, it specifies the amount of jobs to keep. Default behavior is to keep the job in the completed set. See KeepJobsOptions if using that interface instead.

                                                    property removeOnFail

                                                    removeOnFail?: boolean | number | KeepJobsOptions | undefined;
                                                    • A boolean which, if true, removes the job when it fails after all attempts. When a number, it specifies the amount of jobs to keep. Default behavior is to keep the job in the failed set. See KeepJobsOptions if using that interface instead.

                                                    property repeat

                                                    repeat?: CronRepeatOptions | EveryRepeatOptions | undefined;
                                                    • Repeat job according to a cron specification

                                                    property stackTraceLimit

                                                    stackTraceLimit?: number | undefined;
                                                    • Limits the amount of stack trace lines that will be recorded in the stacktrace.

                                                    property timeout

                                                    timeout?: number | undefined;
                                                    • The number of milliseconds after which the job should be fail with a timeout error

                                                    interface JobPromise

                                                    interface JobPromise {}

                                                      method cancel

                                                      cancel: () => void;
                                                      • Abort this job

                                                      interface KeepJobsOptions

                                                      interface KeepJobsOptions {}
                                                      • Specify which jobs to keep after finishing processing this job. If both age and count are specified, then the jobs kept will be the ones that satisfies both properties.

                                                      property age

                                                      age?: number | undefined;
                                                      • Maximum age in *seconds* for job to be kept.

                                                      property count

                                                      count?: number | undefined;
                                                      • Maximum count of jobs to be kept.

                                                      interface Queue

                                                      interface Queue<T = any> extends EventEmitter {}

                                                        property client

                                                        client: Redis.Redis;
                                                        • Queue client (used to add jobs, pause queues, etc);

                                                        property clients

                                                        clients: Redis.Redis[];
                                                        • Array of Redis clients the queue uses

                                                        property name

                                                        name: string;
                                                        • The name of the queue

                                                        method add

                                                        add: {
                                                        (data: T, opts?: JobOptions): Promise<Job<T>>;
                                                        (name: string, data: T, opts?: JobOptions): Promise<Job<T>>;
                                                        };
                                                        • Creates a new job and adds it to the queue. If the queue is empty the job will be executed directly, otherwise it will be placed in the queue and executed as soon as possible.

                                                        • Creates a new named job and adds it to the queue. If the queue is empty the job will be executed directly, otherwise it will be placed in the queue and executed as soon as possible.

                                                        method addBulk

                                                        addBulk: (
                                                        jobs: Array<{
                                                        name?: string | undefined;
                                                        data: T;
                                                        opts?: Omit<JobOptions, 'repeat'> | undefined;
                                                        }>
                                                        ) => Promise<Array<Job<T>>>;
                                                        • Adds an array of jobs to the queue. If the queue is empty the jobs will be executed directly, otherwise they will be placed in the queue and executed as soon as possible. 'repeat' option is not supported in addBulk https://github.com/OptimalBits/bull/issues/1731

                                                        method base64Name

                                                        base64Name: () => string;
                                                        • Returns Queue name in base64 encoded format

                                                        method clean

                                                        clean: (
                                                        grace: number,
                                                        status?: JobStatusClean,
                                                        limit?: number
                                                        ) => Promise<Array<Job<T>>>;
                                                        • Tells the queue remove all jobs created outside of a grace period in milliseconds. You can clean the jobs with the following states: completed, wait (typo for waiting), active, delayed, and failed.

                                                          Parameter grace

                                                          Grace period in milliseconds.

                                                          Parameter status

                                                          Status of the job to clean. Values are completed, wait, active, delayed, and failed. Defaults to completed.

                                                          Parameter limit

                                                          Maximum amount of jobs to clean per call. If not provided will clean all matching jobs.

                                                        method clientName

                                                        clientName: () => string;
                                                        • Returns Queue name with keyPrefix (default: 'bull')

                                                        method close

                                                        close: (doNotWaitJobs?: boolean) => Promise<void>;
                                                        • Closes the underlying redis client. Use this to perform a graceful shutdown.

                                                          close can be called from anywhere, with one caveat: if called from within a job handler the queue won't close until after the job has been processed

                                                        method count

                                                        count: () => Promise<number>;
                                                        • Returns a promise that returns the number of jobs in the queue, waiting or paused. Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time.

                                                        method empty

                                                        empty: () => Promise<void>;
                                                        • Empties a queue deleting all the input lists and associated jobs.

                                                        method getActive

                                                        getActive: (start?: number, end?: number) => Promise<Array<Job<T>>>;
                                                        • Returns a promise that will return an array with the active jobs between start and end.

                                                        method getActiveCount

                                                        getActiveCount: () => Promise<number>;
                                                        • Returns a promise that resolves with the quantity of active jobs.

                                                        method getCompleted

                                                        getCompleted: (start?: number, end?: number) => Promise<Array<Job<T>>>;
                                                        • Returns a promise that will return an array with the completed jobs between start and end.

                                                        method getCompletedCount

                                                        getCompletedCount: () => Promise<number>;
                                                        • Returns a promise that resolves with the quantity of completed jobs.

                                                        method getDelayed

                                                        getDelayed: (start?: number, end?: number) => Promise<Array<Job<T>>>;
                                                        • Returns a promise that will return an array with the delayed jobs between start and end.

                                                        method getDelayedCount

                                                        getDelayedCount: () => Promise<number>;
                                                        • Returns a promise that resolves with the quantity of delayed jobs.

                                                        method getFailed

                                                        getFailed: (start?: number, end?: number) => Promise<Array<Job<T>>>;
                                                        • Returns a promise that will return an array with the failed jobs between start and end.

                                                        method getFailedCount

                                                        getFailedCount: () => Promise<number>;
                                                        • Returns a promise that resolves with the quantity of failed jobs.

                                                        method getJob

                                                        getJob: (jobId: JobId) => Promise<Job<T> | null>;
                                                        • Returns a promise that will return the job instance associated with the jobId parameter. If the specified job cannot be located, the promise callback parameter will be set to null.

                                                        method getJobCountByTypes

                                                        getJobCountByTypes: (types: JobStatus[] | JobStatus) => Promise<JobCounts>;
                                                        • Returns a promise that resolves with the job counts for the given queue of the given job statuses.

                                                        method getJobCounts

                                                        getJobCounts: () => Promise<JobCounts>;
                                                        • Returns a promise that resolves with the job counts for the given queue.

                                                        method getJobLogs

                                                        getJobLogs: (
                                                        jobId: JobId,
                                                        start?: number,
                                                        end?: number
                                                        ) => Promise<{ logs: string[]; count: number }>;
                                                        • Returns a object with the logs according to the start and end arguments. The returned count value is the total amount of logs, useful for implementing pagination.

                                                        method getJobs

                                                        getJobs: (
                                                        types: JobStatus[],
                                                        start?: number,
                                                        end?: number,
                                                        asc?: boolean
                                                        ) => Promise<Array<Job<T>>>;
                                                        • Returns a promise that will return an array of job instances of the given job statuses. Optional parameters for range and ordering are provided.

                                                        method getNextJob

                                                        getNextJob: () => Promise<Job<T> | undefined>;
                                                        • Returns a promise that resolves to the next job in queue.

                                                        method getPausedCount

                                                        getPausedCount: () => Promise<number>;
                                                        • Returns a promise that resolves with the quantity of paused jobs.

                                                        method getRepeatableCount

                                                        getRepeatableCount: () => Promise<number>;
                                                        • Returns a promise that resolves to the quantity of repeatable jobs.

                                                        method getRepeatableJobs

                                                        getRepeatableJobs: (
                                                        start?: number,
                                                        end?: number,
                                                        asc?: boolean
                                                        ) => Promise<JobInformation[]>;
                                                        • Returns JobInformation of repeatable jobs (ordered descending). Provide a start and/or an end index to limit the number of results. Start defaults to 0, end to -1 and asc to false.

                                                        method getWaiting

                                                        getWaiting: (start?: number, end?: number) => Promise<Array<Job<T>>>;
                                                        • Returns a promise that will return an array with the waiting jobs between start and end.

                                                        method getWaitingCount

                                                        getWaitingCount: () => Promise<number>;
                                                        • Returns a promise that resolves with the quantity of waiting jobs.

                                                        method getWorkers

                                                        getWorkers: () => Promise<Redis.Redis[]>;
                                                        • Returns Redis clients array which belongs to current Queue

                                                        method isPaused

                                                        isPaused: (isLocal?: boolean) => Promise<boolean>;
                                                        • Returns a promise that resolves with a boolean if queue is paused

                                                        method isReady

                                                        isReady: () => Promise<this>;
                                                        • Returns a promise that resolves when Redis is connected and the queue is ready to accept jobs. This replaces the ready event emitted on Queue in previous verisons.

                                                        method multi

                                                        multi: () => Redis.Pipeline;
                                                        • Returns a promise that marks the start of a transaction block.

                                                        method nextRepeatableJob

                                                        nextRepeatableJob: (
                                                        name: string,
                                                        data: any,
                                                        opts: JobOptions
                                                        ) => Promise<Job<T>>;
                                                        • ???

                                                        method obliterate

                                                        obliterate: (ops?: { force: boolean }) => Promise<void>;
                                                        • Completely destroys the queue and all of its contents irreversibly.

                                                          Parameter

                                                          ops.force Obliterate the queue even if there are active jobs

                                                        method on

                                                        on: {
                                                        (event: string, callback: (...args: any[]) => void): this;
                                                        (event: 'error', callback: ErrorEventCallback): this;
                                                        (event: 'waiting', callback: WaitingEventCallback): this;
                                                        (event: 'active', callback: ActiveEventCallback<T>): this;
                                                        (event: 'stalled', callback: StalledEventCallback<T>): this;
                                                        (event: 'progress', callback: ProgressEventCallback<T>): this;
                                                        (event: 'completed', callback: CompletedEventCallback<T>): this;
                                                        (event: 'failed', callback: FailedEventCallback<T>): this;
                                                        (event: 'paused', callback: EventCallback): this;
                                                        (event: 'resumed', callback: EventCallback): this;
                                                        (event: 'removed', callback: RemovedEventCallback<T>): this;
                                                        (event: 'cleaned', callback: CleanedEventCallback<T>): this;
                                                        (event: 'drained', callback: EventCallback): this;
                                                        };
                                                        • Listens to queue events

                                                        • An error occured

                                                        • A Job is waiting to be processed as soon as a worker is idling.

                                                        • A job has started. You can use jobPromise.cancel() to abort it

                                                        • A job has been marked as stalled. This is useful for debugging job workers that crash or pause the event loop.

                                                        • A job's progress was updated

                                                        • A job successfully completed with a result

                                                        • A job failed with err as the reason

                                                        • The queue has been paused

                                                        • The queue has been resumed

                                                        • A job successfully removed.

                                                        • Old jobs have been cleaned from the queue. jobs is an array of jobs that were removed, and type is the type of those jobs.

                                                          See Also

                                                          • Queue#clean() for details

                                                        • Emitted every time the queue has processed all the waiting jobs (even if there can be some delayed jobs not yet processed)

                                                        method parseClientList

                                                        parseClientList: (list: string) => Redis.Redis[];
                                                        • Returns Redis clients array which belongs to current Queue from string with all redis clients

                                                          Parameter list

                                                          String with all redis clients

                                                        method pause

                                                        pause: (isLocal?: boolean, doNotWaitActive?: boolean) => Promise<void>;
                                                        • Returns a promise that resolves when the queue is paused.

                                                          A paused queue will not process new jobs until resumed, but current jobs being processed will continue until they are finalized. The pause can be either global or local. If global, all workers in all queue instances for a given queue will be paused. If local, just this worker will stop processing new jobs after the current lock expires. This can be useful to stop a worker from taking new jobs prior to shutting down.

                                                          If doNotWaitActive is true, pause will not wait for any active jobs to finish before resolving. Otherwise, pause will wait for active jobs to finish. See Queue#whenCurrentJobsFinished for more information.

                                                          Pausing a queue that is already paused does nothing.

                                                        method process

                                                        process: {
                                                        (callback: ProcessCallbackFunction<T>): Promise<void>;
                                                        (callback: ProcessPromiseFunction<T>): Promise<void>;
                                                        (callback: string): Promise<void>;
                                                        (concurrency: number, callback: ProcessCallbackFunction<T>): Promise<void>;
                                                        (concurrency: number, callback: ProcessPromiseFunction<T>): Promise<void>;
                                                        (concurrency: number, callback: string): Promise<void>;
                                                        (name: string, callback: ProcessCallbackFunction<T>): Promise<void>;
                                                        (name: string, callback: ProcessPromiseFunction<T>): Promise<void>;
                                                        (name: string, callback: string): Promise<void>;
                                                        (
                                                        name: string,
                                                        concurrency: number,
                                                        callback: ProcessCallbackFunction<T>
                                                        ): Promise<void>;
                                                        (
                                                        name: string,
                                                        concurrency: number,
                                                        callback: ProcessPromiseFunction<T>
                                                        ): Promise<void>;
                                                        (name: string, concurrency: number, callback: string): Promise<void>;
                                                        };
                                                        • Defines a processing function for the jobs placed into a given Queue.

                                                          The callback is called everytime a job is placed in the queue. It is passed an instance of the job as first argument.

                                                          If the callback signature contains the second optional done argument, the callback will be passed a done callback to be called after the job has been completed. The done callback can be called with an Error instance, to signal that the job did not complete successfully, or with a result as second argument (e.g.: done(null, result);) when the job is successful. Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.

                                                          If, however, the callback signature does not contain the done argument, a promise must be returned to signal job completion. If the promise is rejected, the error will be passed as a second argument to the "failed" event. If it is resolved, its value will be the "completed" event's second argument.

                                                        • Defines a processing function for the jobs placed into a given Queue.

                                                          The callback is called everytime a job is placed in the queue. It is passed an instance of the job as first argument.

                                                          If the callback signature contains the second optional done argument, the callback will be passed a done callback to be called after the job has been completed. The done callback can be called with an Error instance, to signal that the job did not complete successfully, or with a result as second argument (e.g.: done(null, result);) when the job is successful. Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.

                                                          If, however, the callback signature does not contain the done argument, a promise must be returned to signal job completion. If the promise is rejected, the error will be passed as a second argument to the "failed" event. If it is resolved, its value will be the "completed" event's second argument.

                                                          Parameter concurrency

                                                          Bull will then call your handler in parallel respecting this maximum value.

                                                        • Defines a processing function for the jobs placed into a given Queue.

                                                          The callback is called everytime a job is placed in the queue. It is passed an instance of the job as first argument.

                                                          If the callback signature contains the second optional done argument, the callback will be passed a done callback to be called after the job has been completed. The done callback can be called with an Error instance, to signal that the job did not complete successfully, or with a result as second argument (e.g.: done(null, result);) when the job is successful. Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.

                                                          If, however, the callback signature does not contain the done argument, a promise must be returned to signal job completion. If the promise is rejected, the error will be passed as a second argument to the "failed" event. If it is resolved, its value will be the "completed" event's second argument.

                                                          Parameter name

                                                          Bull will only call the handler if the job name matches

                                                        • Defines a processing function for the jobs placed into a given Queue.

                                                          The callback is called everytime a job is placed in the queue. It is passed an instance of the job as first argument.

                                                          If the callback signature contains the second optional done argument, the callback will be passed a done callback to be called after the job has been completed. The done callback can be called with an Error instance, to signal that the job did not complete successfully, or with a result as second argument (e.g.: done(null, result);) when the job is successful. Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.

                                                          If, however, the callback signature does not contain the done argument, a promise must be returned to signal job completion. If the promise is rejected, the error will be passed as a second argument to the "failed" event. If it is resolved, its value will be the "completed" event's second argument.

                                                          Parameter name

                                                          Bull will only call the handler if the job name matches

                                                          Parameter concurrency

                                                          Bull will then call your handler in parallel respecting this maximum value.

                                                        method removeJobs

                                                        removeJobs: (pattern: string) => Promise<void>;
                                                        • Removes all the jobs which jobId matches the given pattern. The pattern must follow redis glob-style pattern (syntax)[redis.io/commands/keys]

                                                        method removeRepeatable

                                                        removeRepeatable: {
                                                        (
                                                        repeat: (CronRepeatOptions | EveryRepeatOptions) & {
                                                        jobId?: JobId | undefined;
                                                        }
                                                        ): Promise<void>;
                                                        (
                                                        name: string,
                                                        repeat: (CronRepeatOptions | EveryRepeatOptions) & { jobId?: JobId }
                                                        ): Promise<void>;
                                                        };
                                                        • Removes a given repeatable job. The RepeatOptions and JobId needs to be the same as the ones used for the job when it was added.

                                                        • Removes a given repeatable job. The RepeatOptions and JobId needs to be the same as the ones used for the job when it was added.

                                                          name: The name of the to be removed job

                                                        method removeRepeatableByKey

                                                        removeRepeatableByKey: (key: string) => Promise<void>;
                                                        • Removes a given repeatable job by key.

                                                        method resume

                                                        resume: (isLocal?: boolean) => Promise<void>;
                                                        • Returns a promise that resolves when the queue is resumed after being paused.

                                                          The resume can be either local or global. If global, all workers in all queue instances for a given queue will be resumed. If local, only this worker will be resumed. Note that resuming a queue globally will not resume workers that have been paused locally; for those, resume(true) must be called directly on their instances.

                                                          Resuming a queue that is not paused does nothing.

                                                        method setWorkerName

                                                        setWorkerName: () => Promise<any>;
                                                        • Set clientName to Redis.client

                                                        method toKey

                                                        toKey: (queueType: string) => string;
                                                        • Returns the queue specific key.

                                                        method whenCurrentJobsFinished

                                                        whenCurrentJobsFinished: () => Promise<void>;
                                                        • Returns a promise that resolves when active jobs are finished

                                                        interface QueueOptions

                                                        interface QueueOptions {}

                                                          property defaultJobOptions

                                                          defaultJobOptions?: JobOptions | undefined;

                                                            property limiter

                                                            limiter?: RateLimiter | undefined;

                                                              property prefix

                                                              prefix?: string | undefined;
                                                              • Prefix to use for all redis keys

                                                              property redis

                                                              redis?: Redis.RedisOptions | undefined;
                                                              • Options passed into the ioredis constructor's options parameter. connectionName is overwritten with Queue.clientName(). other properties are copied

                                                              property settings

                                                              settings?: AdvancedSettings | undefined;

                                                                method createClient

                                                                createClient: (
                                                                type: 'client' | 'subscriber' | 'bclient',
                                                                redisOpts?: Redis.RedisOptions
                                                                ) => Redis.Redis | Redis.Cluster;
                                                                • When specified, the Queue will use this function to create new ioredis client connections. This is useful if you want to re-use connections or connect to a Redis cluster.

                                                                interface RateLimiter

                                                                interface RateLimiter {}

                                                                  property bounceBack

                                                                  bounceBack?: boolean | undefined;
                                                                  • When jobs get rate limited, they stay in the waiting queue and are not moved to the delayed queue

                                                                  property duration

                                                                  duration: number;
                                                                  • Per duration in milliseconds

                                                                  property groupKey

                                                                  groupKey?: string | undefined;
                                                                  • Groups jobs with the specified key from the data object passed to the Queue#add ex. "network.handle"

                                                                  property max

                                                                  max: number;
                                                                  • Max numbers of jobs processed

                                                                  interface RepeatOptions

                                                                  interface RepeatOptions {}

                                                                    property endDate

                                                                    endDate?: Date | string | number | undefined;
                                                                    • End date when the repeat job should stop repeating

                                                                    property limit

                                                                    limit?: number | undefined;
                                                                    • Number of times the job should repeat at max.

                                                                    property tz

                                                                    tz?: string | undefined;
                                                                    • Timezone

                                                                    Type Aliases

                                                                    type ActiveEventCallback

                                                                    type ActiveEventCallback<T = any> = (job: Job<T>, jobPromise?: JobPromise) => void;

                                                                      type CleanedEventCallback

                                                                      type CleanedEventCallback<T = any> = (
                                                                      jobs: Array<Job<T>>,
                                                                      status: JobStatusClean
                                                                      ) => void;

                                                                        type CompletedEventCallback

                                                                        type CompletedEventCallback<T = any> = (job: Job<T>, result: any) => void;

                                                                          type DoneCallback

                                                                          type DoneCallback = (error?: Error | null, value?: any) => void;

                                                                            type ErrorEventCallback

                                                                            type ErrorEventCallback = (error: Error) => void;

                                                                              type EventCallback

                                                                              type EventCallback = () => void;

                                                                                type FailedEventCallback

                                                                                type FailedEventCallback<T = any> = (job: Job<T>, error: Error) => void;

                                                                                  type JobId

                                                                                  type JobId = number | string;

                                                                                    type JobStatus

                                                                                    type JobStatus =
                                                                                    | 'completed'
                                                                                    | 'waiting'
                                                                                    | 'active'
                                                                                    | 'delayed'
                                                                                    | 'failed'
                                                                                    | 'paused';

                                                                                      type JobStatusClean

                                                                                      type JobStatusClean =
                                                                                      | 'completed'
                                                                                      | 'wait'
                                                                                      | 'active'
                                                                                      | 'delayed'
                                                                                      | 'failed'
                                                                                      | 'paused';

                                                                                        type ProcessCallbackFunction

                                                                                        type ProcessCallbackFunction<T> = (job: Job<T>, done: DoneCallback) => void;

                                                                                          type ProcessPromiseFunction

                                                                                          type ProcessPromiseFunction<T> = (job: Job<T>) => Promise<void>;

                                                                                            type ProgressEventCallback

                                                                                            type ProgressEventCallback<T = any> = (job: Job<T>, progress: any) => void;

                                                                                              type RemovedEventCallback

                                                                                              type RemovedEventCallback<T = any> = (job: Job<T>) => void;

                                                                                                type StalledEventCallback

                                                                                                type StalledEventCallback<T = any> = (job: Job<T>) => void;

                                                                                                  type WaitingEventCallback

                                                                                                  type WaitingEventCallback = (jobId: JobId) => void;

                                                                                                    Package Files (1)

                                                                                                    Dependencies (2)

                                                                                                    Dev Dependencies (0)

                                                                                                    No dev dependencies.

                                                                                                    Peer Dependencies (0)

                                                                                                    No peer dependencies.

                                                                                                    Badge

                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/bull.

                                                                                                    • Markdown
                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/bull)
                                                                                                    • HTML
                                                                                                      <a href="https://www.jsdocs.io/package/@types/bull"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>