UNPKG

rocketmq-client-nodejs-beta

Version:
51 lines (50 loc) 2.35 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 { HeartbeatRequest, NotifyClientTerminationRequest } from '../../proto/apache/rocketmq/v2/service_pb'; import { MessageView } from '../message'; import { TopicRouteData } from '../route'; import { FilterExpression } from './FilterExpression'; import { SimpleSubscriptionSettings } from './SimpleSubscriptionSettings'; import { Consumer, ConsumerOptions } from './Consumer'; export interface SimpleConsumerOptions extends ConsumerOptions { /** * support tag string as filter, e.g.: * ```ts * new Map() * .set('TestTopic1', 'TestTag1') * .set('TestTopic2', 'TestTag2') * ``` */ subscriptions: Map<string, FilterExpression | string>; /** * set await duration for long-polling, default is 30000ms */ awaitDuration?: number; } export declare class SimpleConsumer extends Consumer { #private; constructor(options: SimpleConsumerOptions); protected getSettings(): SimpleSubscriptionSettings; protected wrapHeartbeatRequest(): HeartbeatRequest; protected wrapNotifyClientTerminationRequest(): NotifyClientTerminationRequest; protected onTopicRouteDataUpdate(topic: string, topicRouteData: TopicRouteData): void; subscribe(topic: string, filterExpression: FilterExpression): Promise<void>; unsubscribe(topic: string): void; receive(maxMessageNum?: number, invisibleDuration?: number): Promise<MessageView[]>; ack(message: MessageView): Promise<void>; changeInvisibleDuration0(message: MessageView, invisibleDuration: number): Promise<void>; }