nodejs-cloud-taskmq
Version:
Node.js TypeScript library for integrating Google Cloud Tasks with MongoDB/Redis/Memory/Custom for a BullMQ-like queue system. Compatible with NestJS but framework-agnostic.
38 lines (37 loc) • 949 B
TypeScript
import 'reflect-metadata';
/**
* Metadata key for process decorators
*/
export declare const PROCESS_METADATA_KEY = "cloud_taskmq:process_metadata";
/**
* Process options
*/
export interface ProcessOptions {
/**
* Process name (if different from method name)
*/
name?: string;
/**
* Concurrency limit for this specific process
*/
concurrency?: number;
}
/**
* Marks a method as a task processor.
* This method will be called to process tasks from the queue.
*
* @param options Process options
*
* @example
* ```typescript
* @Processor('email-queue')
* export class EmailProcessor {
* @Process({ name: 'send-email' })
* async handleEmailTask(job: CloudTask<EmailData>) {
* // Process the email task
* return { success: true };
* }
* }
* ```
*/
export declare function Process(options?: ProcessOptions): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;