UNPKG

@cleotasks/core

Version:

A distributed task queue system for Node.js, inspired by Celery and BullMQ

51 lines (50 loc) 1.49 kB
import { QueueManager } from "../queue/queueManager"; import { RedisInstance } from "../config/redis"; /** * Client mode for Cleo - only schedules jobs, no workers * Perfect for NextJS/Express apps that need to queue tasks */ export declare class CleoClient { private static instances; protected queueManager: QueueManager | null; private isConfigured; private readonly instanceId; private isClientMode; constructor(instanceId?: RedisInstance); static getInstance(instanceId?: RedisInstance): CleoClient; configure(config: { redis: { host: string; port: number; password?: string; tls?: boolean; db?: number; }; }): Promise<void>; getInstanceId(): string; getQueueManager(): QueueManager; /** * Override getWorker to throw error in client mode */ getWorker(queueName: string): never; /** * Override getWorkerManager to throw error in client mode */ getWorkerManager(): never; /** * Check if running in client mode */ isClientModeEnabled(): boolean; /** * Schedule a task without processing it */ scheduleTask(name: string, data: any, options?: any): Promise<any>; /** * Schedule a task to a group */ scheduleGroupTask(methodName: string, taskOptions: any, taskData: any): Promise<void>; /** * Get the task decorator for this instance */ get task(): any; }