Spaces:
Sleeping
Sleeping
File size: 1,059 Bytes
1305386 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import { IAggregationCounter } from './IAggregationCounter';
import { AggregationCounterRef } from './IMessage';
export interface IAggregationCounterAPI {
// Tạo counter mới
createCounter(params: {
requestId: string;
stepId: string;
targetMessageType: string;
expectedCount: number;
timeoutMs?: number;
parentResults?: any;
delayMs?: number;
targetMessageAggregationCounters?: AggregationCounterRef[];
}): Promise<IAggregationCounter>;
// Increment counter
incrementCounter(params: {
aggregationKey: string;
taskType: string;
result: any;
workerId?: string;
messageId?: string; // ID của message đã hoàn thành
}): Promise<{
counter: IAggregationCounter | null;
isComplete: boolean;
messageCreated?: boolean;
}>;
// Lấy counter theo key
getCounterByKey(aggregationKey: string): Promise<IAggregationCounter | null>;
// Lấy counters theo requestId
getCountersByRequestId(requestId: string): Promise<IAggregationCounter[]>;
} |