rocketmq-client-nodejs
Version:
RocketMQ Node.js Client
58 lines (57 loc) • 2.8 kB
TypeScript
/**
* 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 { MessageView } from '../message';
import { ConsumeService } from './ConsumeService';
import { MessageListener } from './MessageListener';
import type { ProcessQueue } from './ProcessQueue';
export declare class FifoConsumeService extends ConsumeService {
#private;
constructor(clientId: string, messageListener: MessageListener, enableFifoConsumeAccelerator?: boolean);
consume(pq: ProcessQueue, messageViews: MessageView[]): void;
/**
* Get the group key for the given message view.
* Subclasses can override this method to provide different grouping logic.
*
* @param messageView - The message view
* @return {string} The group key, empty string means no grouping
*/
protected getMessageGroupKey(messageView: MessageView): string;
/**
* Consume messages iteratively using the provided message view array.
* This method handles corrupted messages and continues processing the next valid message.
*
* @param pq - The process queue
* @param messageViews - The message views to consume
* @param startIndex - The index to start consuming from
* @return {Promise<void>} Promise that resolves when all messages are consumed
*/
protected consumeIteratively(pq: ProcessQueue, messageViews: MessageView[], startIndex: number): Promise<void>;
/**
* Get the next valid message from the message view array.
* Skip corrupted messages and return the first valid one.
* Returns null if there are no more messages.
*
* @param pq - The process queue
* @param messageViews - The message views
* @param startIndex - The index to start searching from
* @return {{ messageView: MessageView; nextIndex: number } | null} The next valid message and the index after it, or null
*/
protected getNextValidMessage(pq: ProcessQueue, messageViews: MessageView[], startIndex: number): {
messageView: MessageView;
nextIndex: number;
} | null;
}