import { TypeDaprPubSubCallback } from "../../types/DaprPubSubCallback.type"; import { KeyValueType } from "../../types/KeyValue.type"; import { BulkSubscribeOptions } from "../../types/pubsub/BulkSubscribeOptions.type"; import { DaprPubSubRouteType } from "../../types/pubsub/DaprPubSubRouteType.type"; import { PubSubSubscriptionOptionsType } from "../../types/pubsub/PubSubSubscriptionOptions.type"; import { PubSubSubscriptionsType } from "../../types/pubsub/PubSubSubscriptions.type"; export default interface IServerPubSub { /** * Subscribe to a topic. * * @param pubSubName name of the pubsub * @param topic name of the topic * @param cb callback function to handle messages * @param route The HTTP route override to register for the event subscription. * Default value is `/route-${pubsubName}-${topic}`. Ignored if gRPC is used. * @param metadata metadata for the subscription */ subscribe(pubSubName: string, topic: string, cb: TypeDaprPubSubCallback, route?: string | DaprPubSubRouteType, metadata?: KeyValueType): Promise; /** * Subscribe to a topic with options. * * @param pubSubName name of the pubsub * @param topic name of the topic * @param options options */ subscribeWithOptions(pubsubName: string, topic: string, options: PubSubSubscriptionOptionsType): Promise; /** * Subscribe to events on a specific topic that was subscribed to already. * * @param pubSubName name of the pubsub * @param topic name of the topic * @param route The Dapr route representing how messages should be routed to * @param cb callback function to handle messages */ subscribeToRoute(pubsubName: string, topic: string, route: string | DaprPubSubRouteType, cb: TypeDaprPubSubCallback): void; /** * Bulk Subscribe to a topic with providing configurations for bulk subscribe. * If maxMessagesCount or/and maxAwaitDurationMs not provided, default values * for related component will be used. * * @param pubSubName name of the pubsub * @param topic name of the topic * @param cb callback function to handle messages * @param maxMessagesCount max messages count * @param maxAwaitDurationMs max await duration in milliseconds * @param route The HTTP route override to register for the event subscription. * Default value is `/route-${pubsubName}-${topic}`. Ignored if gRPC is used. * @param metadata metadata for the subscription */ subscribeBulk(pubSubName: string, topic: string, cb: TypeDaprPubSubCallback, bulkSubscribeOptions?: BulkSubscribeOptions): Promise; /** * Get a list of the registered subscriptions */ getSubscriptions(): PubSubSubscriptionsType; }