import type { BrokerDriverContract, ChannelContract } from "../../contracts"; import { EventMessage } from "../../message-managers/event-message"; import { EventConsumerClass } from "../../message-managers/types"; import type { BrokerEvent, BrokerEventListener, ChannelOptions, HealthCheckResult, RabbitMQConnectionOptions } from "../../types"; /** * RabbitMQ Driver * * Implementation of BrokerDriverContract for RabbitMQ/AMQP. * * **Important:** This driver requires the `amqplib` package to be installed. * Install it with: `npx warlock add herald --driver=rabbitmq` or `npm install amqplib` * * @example * ```typescript * const driver = new RabbitMQDriver({ * driver: "rabbitmq", * host: "localhost", * port: 5672, * username: "guest", * password: "guest", * }); * * await driver.connect(); * const channel = driver.channel("user.created"); * ``` */ export declare class RabbitMQDriver implements BrokerDriverContract { readonly name: "rabbitmq"; readonly consumers: EventConsumerClass[]; private readonly options; private readonly events; private readonly channels; private connection; private amqpChannel; private _isConnected; /** * Create a new RabbitMQ driver * * @param options - RabbitMQ connection options */ constructor(options: RabbitMQConnectionOptions); /** * Whether connected to RabbitMQ */ get isConnected(): boolean; /** * Subscribe the given consumer class to the driver * * @param consumer - Consumer class to subscribe * * @example * ```typescript * driver.subscribe(UserUpdatedConsumer); * ``` */ subscribe(Consumer: EventConsumerClass): () => void; /** * Unsubscribe the given consumer */ unsubscribe(Consumer: EventConsumerClass): void; /** * Publish the given event message. * Auto-creates the channel if it hasn't been accessed before. */ publish>(event: EventMessage): void; /** * Connect to RabbitMQ */ connect(): Promise; /** * Build connection URL from options */ private buildConnectionUrl; /** * Handle reconnection */ private handleReconnect; /** * Disconnect from RabbitMQ */ disconnect(): Promise; /** * Register event listener */ on(event: BrokerEvent, listener: BrokerEventListener): void; /** * Remove event listener */ off(event: BrokerEvent, listener: BrokerEventListener): void; /** * Get or create a channel */ channel(name: string, options?: ChannelOptions): ChannelContract; /** * Start consuming messages */ startConsuming(): Promise; /** * Stop consuming messages from all subscribed channels. * Gracefully cancels all active consumers. */ stopConsuming(): Promise; /** * Health check */ healthCheck(): Promise; /** * Get all channel names */ getChannelNames(): string[]; /** * Close a specific channel */ closeChannel(name: string): Promise; /** * Get the raw AMQP channel (for advanced use) */ getRawChannel(): any; /** * Get the raw connection (for advanced use) */ getRawConnection(): any; } //# sourceMappingURL=rabbitmq-driver.d.ts.map