UNPKG

kubemq-js

Version:

kubemq js/ts library for KubeMQ Message Broker

168 lines 5.33 kB
import { BaseMessage } from '../client/KubeMQClient'; import { TypedEvent } from '../client/KubeMQClient'; import * as pb from '../protos'; import * as grpc from '@grpc/grpc-js'; import { PubsubClient } from '../pubsub/PubsubClient'; export declare enum EventStoreType { EventsStoreTypeUndefined = 0, StartNewOnly = 1, StartFromFirst = 2, StartFromLast = 3, StartAtSequence = 4, StartAtTime = 5, StartAtTimeDelta = 6 } export interface EventsMessage extends BaseMessage { } export interface EventsStoreMessage extends BaseMessage { } export declare class EventMessageReceived { /** * Unique identifier for the received event message. */ id: string; /** * The client ID from which the event message was sent. */ fromClientId: string; /** * The timestamp when the event message was received. */ timestamp: Date; /** * The channel from which the event message was received. */ channel: string; /** * Metadata associated with the received event message. */ metadata: string; /** * Body of the received event message in bytes. */ body: Uint8Array | string; /** * Tags associated with the received event message as key-value pairs. */ tags: Map<string, string>; /** * Constructor to initialize the fields. */ constructor(); /** * Decodes a KubeMQ EventReceive object into an EventMessageReceived instance. * * @param event The EventReceive object to decode. * @return The decoded EventMessageReceived instance. */ static decode(event: pb.kubemq.EventReceive): EventMessageReceived; } export declare class EventsSendResult { /** * Unique identifier for the sent event message. */ id: string; /** * Indicates whether the event message was successfully sent. */ sent: boolean; /** * Error message if the event message was not sent successfully. */ error: string; constructor(id?: string, sent?: boolean, error?: string); /** * Decodes a KubeMQ Result object into an EventSendResult instance. * * @param result The KubeMQ Result object to decode. * @returns The decoded EventSendResult instance. */ static decode(result: pb.kubemq.Result): EventsSendResult; /** * Returns a string representation of the event send result. * * @returns A string containing the event send result details. */ toString(): string; } export declare class EventsSubscriptionRequest { channel: string; group?: string; onReceiveEventCallback?: (event: EventMessageReceived) => void; onErrorCallback?: (error: string) => void; observer?: grpc.ClientReadableStream<pb.kubemq.EventReceive>; isReconnecting: boolean; constructor(channel: string, group?: string); validate(): void; encode(pubSubClient: PubsubClient): pb.kubemq.Subscribe; raiseOnReceiveMessage(event: EventMessageReceived): void; raiseOnError(errorMsg: string): void; cancel(): void; reconnect(pubSubClient: PubsubClient, reconnectIntervalSeconds: number): void; } export interface EventsSubscriptionResponse { onState: TypedEvent<string>; unsubscribe(): void; } export declare class EventStoreMessageReceived { /** * Unique identifier for the received event message. */ id: string; /** * The client ID from which the event message was sent. */ fromClientId: string; /** * The timestamp when the event message was received. */ timestamp: Date; /** * The channel from which the event message was received. */ channel: string; /** * Metadata associated with the received event message. */ metadata: string; /** * Body of the received event message in bytes. */ body: Uint8Array | string; /** * Tags associated with the received event message as key-value pairs. */ tags: Map<string, string>; sequence: number; /** * Constructor to initialize the fields. */ constructor(); /** * Decodes a KubeMQ EventReceive object into an EventMessageReceived instance. * * @param event The EventReceive object to decode. * @return The decoded EventMessageReceived instance. */ static decode(event: pb.kubemq.EventReceive): EventStoreMessageReceived; } export declare class EventsStoreSubscriptionRequest { channel: string; group?: string; eventsStoreType: EventStoreType; eventsStoreSequenceValue?: number; eventsStoreStartTime?: Date; onReceiveEventCallback?: (event: EventStoreMessageReceived) => void; onErrorCallback?: (error: string) => void; observer?: grpc.ClientReadableStream<pb.kubemq.EventReceive>; isReconnecting: boolean; constructor(channel: string, group?: string); validate(): void; encode(pubSubClient: PubsubClient): pb.kubemq.Subscribe; convertToEventStoreType(eventsStoreType: EventStoreType): pb.kubemq.Subscribe.EventsStoreType; raiseOnReceiveMessage(event: EventStoreMessageReceived): void; raiseOnError(errorMsg: string): void; cancel(): void; reconnect(pubSubClient: PubsubClient, reconnectIntervalSeconds: number): void; } //# sourceMappingURL=eventTypes.d.ts.map