@penkov/tasks_queue
Version:
A lightweight PostgreSQL-backed task queue system with scheduling, retries, backoff strategies, and priority handling. Designed for efficiency and observability in modern Node.js applications.
26 lines (25 loc) • 700 B
TypeScript
import "reflect-metadata";
/**
* Metadata key that marks methods as queue workers.
*/
export declare const TASKS_QUEUE_WORKER_METADATA: unique symbol;
/**
* Method-level registration options for queue workers discovered via NestJS.
*/
export interface WorkerOptions {
/**
* Queue name this method should consume.
*/
queue: string;
/**
* Optional pool name. If omitted, defaults to `default`.
*/
pool?: string;
}
/**
* Mark a provider method as a queue worker handler.
*
* The method should follow the runtime contract:
* `(payload: any, context: TaskContext) => Promise<void>`.
*/
export declare const Worker: (options: WorkerOptions) => MethodDecorator;