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

    Class JobPro<DataType, ReturnType, NameType>

    Job

    Type Parameters

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

    Hierarchy

    Index
    gid: string | number
    id?: string

    The options object for this job.

    • Extend the lock for this job.

      Parameters

      • token: string

        unique token for the lock

      • duration: number

        lock duration in milliseconds

      Returns Promise<number>

    • Logs one row of log data.

      Parameters

      • logRow: string

        string with log data to be logged.

      Returns Promise<number>

      The total number of log entries for this job so far.

    • 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

    • addJobLog

      Parameters

      • queue: MinimalQueuePro

        A minimal queue instance

      • jobId: string

        Job id

      • logRow: string

        String with a row of log data to be logged

      • OptionalkeepLogs: number

        The optional amount of log entries to preserve

      Returns Promise<number>

      The total number of log entries for this job so far.

    • 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: MinimalQueuePro

        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>