@aichatwar/shared 1.0.123 → 1.0.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,6 +14,6 @@ export declare abstract class Listener<T extends BaseEvent> {
|
|
|
14
14
|
private crashHandlerSetup;
|
|
15
15
|
constructor(consumer: Consumer);
|
|
16
16
|
private setupCrashHandler;
|
|
17
|
-
ack(): Promise<void>;
|
|
17
|
+
ack(payload?: EachMessagePayload): Promise<void>;
|
|
18
18
|
listen(): Promise<void>;
|
|
19
19
|
}
|
|
@@ -39,15 +39,17 @@ class Listener {
|
|
|
39
39
|
this.crashHandlerSetup = true;
|
|
40
40
|
}
|
|
41
41
|
// Manual acknowledgment method
|
|
42
|
-
|
|
42
|
+
// Accepts optional payload for custom consumer patterns (e.g., realtime-gateway)
|
|
43
|
+
ack(payload) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const targetPayload = payload || this.currentPayload;
|
|
46
|
+
if (!targetPayload) {
|
|
47
|
+
throw new Error('No current payload to acknowledge. Either set currentPayload or pass payload parameter.');
|
|
46
48
|
}
|
|
47
49
|
yield this.consumer.commitOffsets([{
|
|
48
|
-
topic:
|
|
49
|
-
partition:
|
|
50
|
-
offset: (BigInt(
|
|
50
|
+
topic: targetPayload.topic,
|
|
51
|
+
partition: targetPayload.partition,
|
|
52
|
+
offset: (BigInt(targetPayload.message.offset) + BigInt(1)).toString()
|
|
51
53
|
}]);
|
|
52
54
|
console.log(`Message manually acknowledged for topic: ${this.topic}`);
|
|
53
55
|
});
|