@taskforcesh/bullmq-pro - v7.35.2
    Preparing search index...

    Class JobPro<DataType, ReturnType, NameType>

    Job

    Type Parameters

    • DataType = any
    • ReturnType = any
    • NameType extends string = string

    Hierarchy

    Index

    Constructors

    Properties

    gid: string | number
    id?: string

    The options object for this job.

    Methods

    • Prepares a job to be passed to Sandbox.

      Returns JobProJsonSandbox

    • Extend the lock for this job.

      Parameters

      • token: string

        unique token for the lock

      • duration: number

        lock duration in milliseconds

      Returns Promise<number>

    • Moves a job to the completed queue. Returned job to be used with Queue.prototype.nextJobFromJobData.

      Parameters

      • returnValue: ReturnType

        The jobs success message.

      • token: string

        Worker token used to acquire completed job.

      • fetchNext: boolean = true

        True when wanting to fetch the next job.

      Returns Promise<void | any[]>

      Returns the jobData of the next job in the waiting queue.

    • Moves a job to the failed queue.

      Parameters

      • err: Error

        the jobs error message.

      • token: string

        token to check job is locked by current worker

      • fetchNext: boolean = false

        true when wanting to fetch the next job

      Returns Promise<void | any[]>

      void

    • Set job as failed. This method will set the current job instance as failed, it is useful when processing batches to mark a certain job in a batch as failed while completing the rest.

      Parameters

      • err: Error

        The error object to be associated with the job.

      Returns void

    • Instantiates a Job from a JobJsonRaw object (coming from a deserialized JSON object)

      Type Parameters

      • T = any
      • R = any
      • N extends string = string

      Parameters

      • queue: MinimalQueue

        the queue where the job belongs to.

      • json: JobProJsonRaw

        the plain object containing the job.

      • OptionaljobId: string

        an optional job id (overrides the id coming from the JSON object)

      Returns JobPro<T, R, N>