@glowlabs-org/events-sdk
Version:
Typed event SDK for Glow, powered by RabbitMQ and Zod.
47 lines (46 loc) • 1.84 kB
TypeScript
import amqp from "amqplib";
export interface CreateAndBindQueueOptions {
username: string;
password: string;
exchange: string;
queue: string;
exchangeType?: string;
queueOptions?: amqp.Options.AssertQueue;
exchangeOptions?: amqp.Options.AssertExchange;
routingKey?: string;
host?: string;
}
/**
* Create a RabbitMQ topic exchange (admin credentials required).
*
* @param options - Connection and exchange options
* @returns Promise<void>
*/
export declare function createExchange({ username, password, exchange, exchangeType, exchangeOptions, host, }: Omit<CreateAndBindQueueOptions, "queue" | "queueOptions" | "routingKey"> & {
host?: string;
}): Promise<void>;
/**
* Create a RabbitMQ queue and bind it to a topic exchange (admin credentials required).
*
* @param options - Connection, queue, and exchange options
* @returns Promise<void>
*/
export declare function bindQueueToExchange({ username, password, exchange, queue, exchangeType, queueOptions, exchangeOptions, routingKey, host, }: CreateAndBindQueueOptions): Promise<void>;
/**
* Delete a RabbitMQ exchange (admin credentials required).
*
* @param options - Connection and exchange options
* @returns Promise<void>
*/
export declare function deleteExchange({ username, password, exchange, host, }: Omit<CreateAndBindQueueOptions, "queue" | "queueOptions" | "exchangeType" | "exchangeOptions" | "routingKey"> & {
host?: string;
}): Promise<void>;
/**
* Delete a RabbitMQ queue (admin credentials required).
*
* @param options - Connection and queue options
* @returns Promise<void>
*/
export declare function deleteQueue({ username, password, queue, host, }: Omit<CreateAndBindQueueOptions, "exchange" | "exchangeType" | "exchangeOptions" | "queueOptions" | "routingKey"> & {
host?: string;
}): Promise<void>;