dt-common-device
Version:
A secure and robust device management library for IoT applications
34 lines (33 loc) • 1.15 kB
TypeScript
import { IWebhookQueueOptions } from "../types/webhook.types";
export interface IWebhookQueue {
/**
* Add a webhook to the appropriate queue based on propertyId and pmsType
*/
addWebhookToQueue(propertyId: string, pmsType: string, webhookData: any, options?: IWebhookQueueOptions): Promise<string>;
/**
* Mark a webhook job as completed (processed successfully)
*/
markWebhookCompleted(propertyId: string, pmsType: string, jobId: string): Promise<void>;
/**
* Mark a webhook job as failed
*/
markWebhookFailed(propertyId: string, pmsType: string, jobId: string, error?: string): Promise<void>;
/**
* Poll available webhook from ANY available webhook queue in Redis
*/
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>;
}