UNPKG

kubemq-js

Version:

kubemq js/ts library for KubeMQ Message Broker

70 lines 2.1 kB
import * as grpc from '@grpc/grpc-js'; import * as kubemq from '../protos'; import { Config } from './config'; /** * Represents the server information returned on a Ping request. */ export interface ServerInfo { host: string; version: string; serverStartTime: number; serverUpTimeSeconds: number; } /** * @internal */ export interface BaseMessage { /** message id, a UUID id will generated when id is empty */ id?: string; /** channel name */ channel?: string; /** optional clientId name specific for this message*/ clientId?: string; /** optional metadata string */ metadata?: string; /** message payload */ body?: Uint8Array | string; /** optional message tags key/value map */ tags?: Map<string, string>; } /** * KubeMQClient - Client for communicating with a KubeMQ server using gRPC. * Supports plain and TLS (Transport Layer Security) connections. */ export declare class KubeMQClient { protected address: string; clientId: string; protected authToken?: string; protected tls: boolean; protected tlsCertFile?: string; protected tlsKeyFile?: string; protected tlsCaCertFile?: string; protected maxReceiveSize: number; protected reconnectIntervalSeconds: number; protected logLevel: string; grpcClient: kubemq.kubemq.kubemqClient; private metadata; constructor(config: Config); private init; protected callOptions(): grpc.CallOptions; ping(): Promise<ServerInfo>; close(): void; getMetadata(): grpc.Metadata; } export interface Listener<T> { (event: T): any; } export interface Disposable { dispose(): any; } /** passes through events as they happen. You will not get events from before you start listening */ export declare class TypedEvent<T> { private listeners; private listenersOncer; on: (listener: Listener<T>) => Disposable; once: (listener: Listener<T>) => void; off: (listener: Listener<T>) => void; emit: (event: T) => void; pipe: (te: TypedEvent<T>) => Disposable; } //# sourceMappingURL=KubeMQClient.d.ts.map