UNPKG

torotask

Version:

Task queue processing in NodeJS based on BullMQ and Redis

38 lines 1.88 kB
import { Queue, Job } from 'bullmq'; import { Logger } from 'pino'; import { ToroTask } from './client.js'; import type { BulkJob, TaskJobData, TaskJobOptions, TaskJobState, TaskQueueOptions } from './types/index.js'; import { TaskJob } from './job.js'; export declare class TaskQueue<PayloadType = any, ResultType = any, NameType extends string = string, const DataType extends TaskJobData = TaskJobData<PayloadType>> extends Queue<any, ResultType, NameType> { readonly taskClient: ToroTask; readonly logger: Logger; constructor(taskClient: ToroTask, name: string, options?: Partial<TaskQueueOptions>); /** * Override the Job class to use TaskJob * @returns {typeof Job} */ protected get Job(): typeof Job; protected get TaskJob(): typeof TaskJob<PayloadType, ResultType, NameType>; /** * Get the Redis client instance used by the queue. * @returns The Redis client instance. */ getRedisClient(): Promise<import("bullmq").RedisClient>; /** * Core logic to add a job to the queue. * Public method intended for use by subclasses or related classes (e.g., SubTask). */ add(name: NameType, payload: PayloadType, options?: TaskJobOptions, state?: TaskJobState): Promise<TaskJob<PayloadType, ResultType, NameType>>; /** * Core logic to add multiple jobs to the queue. * Public method intended for use by subclasses or related classes (e.g., SubTask). */ addBulk(jobs: BulkJob<DataType>[]): Promise<TaskJob<PayloadType, ResultType>[]>; /** * Core logic to add a job and wait for its completion. * Public method intended for use by subclasses or related classes. */ _runJobAndWait(name: NameType, payload: PayloadType, options: TaskJobOptions, state?: TaskJobState): Promise<ResultType>; protected queueEvents?: any; } //# sourceMappingURL=queue.d.ts.map