UNPKG

dt-common-device

Version:

A secure and robust device management library for IoT applications

42 lines (41 loc) 1.66 kB
import { IWebhookQueue } from "../interfaces/IWebhookQueue"; export declare class WebhookQueueService implements IWebhookQueue { private readonly webhookQueues; constructor(); private generateQueueName; /** * Add a webhook to the appropriate queue based on propertyId and pmsType * Creates queue if it doesn't exist */ addWebhookToQueue(propertyId: string, pmsType: string, webhookData: any, options?: any): Promise<string>; /** * Mark a webhook job as completed (processed successfully) * Note: Jobs are now removed immediately when polled, so this method is for logging purposes */ markWebhookCompleted(propertyId: string, pmsType: string, jobId: string): Promise<void>; /** * Mark a webhook job as failed * Note: Jobs are now removed immediately when polled, so this method is for logging purposes */ markWebhookFailed(propertyId: string, pmsType: string, jobId: string, error?: string): Promise<void>; /** * Poll available webhook from ANY available webhook queue in Redis * This method will discover all queues in Redis and filter only webhook queues */ pollWebhookFromQueues(): Promise<{ jobId: string; data: any; propertyId: string; pmsType: string; queueName: string; } | null>; /** * Get all available webhook queue names from Redis */ getAllQueueNames(): Promise<string[]>; /** * Get total waiting count across all webhook queues */ getTotalWaitingCount(): Promise<number>; static getOrCreateQueue(queueKey: string, queues: Map<string, any>): Promise<any>; }