dt-common-device
Version:
A secure and robust device management library for IoT applications
71 lines (70 loc) • 2.58 kB
TypeScript
import { IWebhookQueue } from "../interfaces";
import { IWebhookQueueConfig } from "../types/webhook.types";
/**
* Integration service that provides a simple interface for using webhook queues
* in existing PMS services without major refactoring
*/
export declare class WebhookQueueIntegration {
private webhookQueue;
private isInitialized;
/**
* Initialize the webhook queue system
* @param config Configuration for the webhook queue
* @param webhookProcessor Function to process webhooks
*/
initialize(config: IWebhookQueueConfig, webhookProcessor: (webhookData: any, pmsType: string) => Promise<any>): Promise<void>;
/**
* Queue a webhook for processing
* @param propertyId Property ID
* @param pmsType PMS type
* @param webhookData Webhook payload
* @returns Job ID
*/
queueWebhook(propertyId: string, pmsType: string, webhookData: any): Promise<string>;
/**
* Get queue status for monitoring
* @param propertyId Property ID
* @param pmsType PMS type
*/
getQueueStatus(propertyId: string, pmsType: string): Promise<import("../types/webhook.types").IWebhookQueueStatus>;
/**
* Get all queue statuses for a property
* @param propertyId Property ID
*/
getAllQueueStatuses(propertyId: string): Promise<Record<string, import("../types/webhook.types").IWebhookQueueStatus>>;
/**
* Check if webhook queue integration is initialized
*/
isReady(): boolean;
/**
* Shutdown the webhook queue system
*/
shutdown(): Promise<void>;
/**
* Get the underlying webhook queue service
*/
getWebhookQueue(): IWebhookQueue | null;
/**
* Default webhook processor that can be overridden
*/
private getDefaultWebhookProcessor;
/**
* Set a custom webhook processor for a specific queue
* @param propertyId Property ID
* @param pmsType PMS type
* @param processor Custom processor function
*/
setCustomProcessor(propertyId: string, pmsType: string, processor: (webhookData: any, pmsType: string) => Promise<any>): Promise<void>;
/**
* Clean up old jobs from a queue
* @param propertyId Property ID
* @param pmsType PMS type
*/
cleanupQueue(propertyId: string, pmsType: string): Promise<void>;
/**
* Get queue metrics for monitoring
* @param propertyId Property ID
* @param pmsType PMS type
*/
getQueueMetrics(propertyId: string, pmsType: string): Promise<import("../types/webhook.types").IWebhookQueueMetrics>;
}