UNPKG

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.

36 lines (35 loc) 963 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CLOUD_TASK_CONSUMER_KEY = void 0; exports.CloudTaskConsumer = CloudTaskConsumer; require("reflect-metadata"); /** * Metadata key for cloud task consumer decorators */ exports.CLOUD_TASK_CONSUMER_KEY = 'cloud_taskmq:cloud_task_consumer'; /** * Decorator for marking a class as a CloudTask consumer. * This decorator sets up HTTP endpoints for Google Cloud Tasks to call. * * @param options Consumer configuration options * * @example * ```typescript * @CloudTaskConsumer({ * queueName: 'email-queue', * path: '/tasks/email', * method: 'POST' * }) * export class EmailTaskConsumer { * async handleTask(taskData: any) { * // Process the task * return { success: true }; * } * } * ``` */ function CloudTaskConsumer(options) { return (target) => { Reflect.defineMetadata(exports.CLOUD_TASK_CONSUMER_KEY, options, target); }; }