@lexamica-modules/job-queue
Version:
The package for the Lexamica Job Queue SDK powered by Redis and BullMQ
31 lines (30 loc) • 956 B
TypeScript
import { Job } from "bullmq";
export type JobExecuter = (job: Job) => Promise<unknown>;
export interface WorkerOptions {
concurrency: number;
onSuccess?: <ReturnData>(input: {
jobId: string;
returnvalue: ReturnData;
}) => Promise<void>;
onFailure?: (input: {
jobId: string;
failedReason: string;
}) => Promise<void>;
onProgress?: (input: {
jobId: string;
data: number | object;
}) => Promise<void>;
}
export type WorkerCompleteHandler = (job: Job, returnvalue: unknown) => Promise<void>;
export type WorkerFailedHandler = (job: Job | undefined, error: Error) => Promise<void>;
export type WorkerErrorHandler = (err: Error) => Promise<void>;
export declare enum QueuePermissions {
READ = "read",
WRITE = "write",
EXECUTE = "execute"
}
export declare enum Consumers {
MAINFRAME = "mainframe",
INTEGRATION_API = "integrationAPI",
UTILITY_API = "utilityAPI"
}