UNPKG

@gravityai-dev/gravity-server

Version:

Integration SDK for the Gravity AI orchestration platform - Connect any AI platform in minutes

20 lines 893 B
/** * Simple Event Bus for Gravity AI */ import { RedisOptions } from "../RedisManager"; export type EventHandler<T = any> = (event: T) => void | Promise<void>; export declare class EventBus { private options; private serviceId; private publisher; private subscriber; private handlers; constructor(options: RedisOptions, serviceId: string); static fromRedisConfig(host: string, port: number, password: string | undefined, serviceId: string, username?: string, db?: number): EventBus; static fromCredentials(host: string, port: number, password: string | undefined, serviceId: string): EventBus; private setupSubscriber; publish(channel: string, payload: any): Promise<void>; subscribe<T = any>(channel: string, handler: EventHandler<T>): Promise<() => Promise<void>>; disconnect(): Promise<void>; } //# sourceMappingURL=SimpleEventBus.d.ts.map