UNPKG

rocketmq-client-nodejs

Version:
98 lines (97 loc) 3.13 kB
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { NotifyUnsubscribeLiteCommand } from '../../proto/apache/rocketmq/v2/service_pb'; import { Resource } from '../route'; import { LitePushConsumerImpl } from './LitePushConsumerImpl'; import { OffsetOption } from './OffsetOption'; /** * Manages lite topic subscriptions for LitePushConsumer. * * <p>LiteSubscriptionManager handles: * - Maintaining the set of subscribed lite topics * - Periodic synchronization of lite subscriptions with server * - Quota management and verification * - Handling unsubscribe commands from server</p> */ export declare class LiteSubscriptionManager { private readonly consumerImpl; private readonly bindTopic; private readonly group; private readonly liteTopicSet; private liteSubscriptionQuota; private maxLiteTopicSize; private syncTimer?; constructor(consumerImpl: LitePushConsumerImpl, bindTopic: Resource, group: Resource); /** * Start periodic sync of lite subscriptions. */ startUp(): void; /** * Stop the sync timer. */ shutdown(): void; /** * Get the bind topic name. */ getBindTopicName(): string; /** * Get the consumer group name. */ getConsumerGroupName(): string; /** * Get a copy of the lite topic set. */ getLiteTopicSet(): Set<string>; /** * Sync settings from server. */ sync(settings: any): void; /** * Subscribe to a lite topic. */ subscribeLite(liteTopic: string, offsetOption?: OffsetOption | null): Promise<void>; /** * Unsubscribe from a lite topic. */ unsubscribeLite(liteTopic: string): Promise<void>; /** * Periodic sync of all lite subscriptions. */ private syncAllLiteSubscription; /** * Sync lite subscription with server. */ private syncLiteSubscription; /** * Handle notify unsubscribe lite command from server. */ onNotifyUnsubscribeLiteCommand(command: NotifyUnsubscribeLiteCommand): void; /** * Validate lite topic name. */ private validateLiteTopic; /** * Check lite subscription quota. */ private checkLiteSubscriptionQuota; /** * Returns a string representation of this LiteSubscriptionManager. * * @return String representation */ toString(): string; }