UNPKG

nestjs-google-pubsub-microservice

Version:
36 lines (35 loc) 1.87 kB
import { ClientConfig, Message, PublishOptions, PubSub, SubscriberOptions, Subscription } from '@google-cloud/pubsub'; import { CustomTransportStrategy, Server } from '@nestjs/microservices'; import { Logger } from '@nestjs/common'; import { GCPubSubOptions } from './gc-pubsub.interface'; import { GCPubSubEvents } from './gc-pubsub.events'; export declare class GCPubSubServer extends Server<GCPubSubEvents> implements CustomTransportStrategy { protected readonly options: GCPubSubOptions; protected logger: Logger; protected readonly clientConfig: ClientConfig; protected readonly topicName: string; protected readonly publisherConfig: PublishOptions; protected readonly subscriptionName: string; protected readonly subscriberConfig: SubscriberOptions; protected readonly noAck: boolean; protected readonly replyTopics: Set<string>; protected readonly init: boolean; protected readonly checkExistence: boolean; protected readonly scopedEnvKey: string | null; protected readonly subscriptionFilter: string | undefined; protected pendingEventListeners: Array<{ event: keyof GCPubSubEvents; callback: GCPubSubEvents[keyof GCPubSubEvents]; }>; protected client: PubSub | null; protected subscription: Subscription | null; constructor(options: GCPubSubOptions); listen(callback: () => void): Promise<void>; close(): Promise<void>; handleMessage(message: Message): Promise<any>; sendMessage<T = any>(message: T, replyTo: string, id: string): Promise<void>; createIfNotExists(create: () => Promise<any>): Promise<void>; createClient(): PubSub; on<EventKey extends keyof GCPubSubEvents = keyof GCPubSubEvents, EventCallback extends GCPubSubEvents[EventKey] = GCPubSubEvents[EventKey]>(event: EventKey, callback: EventCallback): void; unwrap<T>(): T; }