@lexamica-modules/job-queue
Version:
The package for the Lexamica Job Queue SDK powered by Redis and BullMQ
41 lines (33 loc) • 902 B
text/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 enum QueuePermissions {
READ = "read",
WRITE = "write",
EXECUTE = "execute",
}
export enum Consumers {
MAINFRAME = "mainframe",
INTEGRATION_API = "integrationAPI",
UTILITY_API = "utilityAPI",
}