@aichatwar/shared 1.0.125 → 1.0.126
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.
|
@@ -24,11 +24,12 @@ class Publisher {
|
|
|
24
24
|
let lastError = null;
|
|
25
25
|
for (let attempt = 1; attempt <= this.maxRetries; attempt++) {
|
|
26
26
|
try {
|
|
27
|
+
const messageKey = data.id || undefined; // Use id as key for partitioning if available
|
|
27
28
|
const result = yield this.producer.send({
|
|
28
29
|
topic: this.topic,
|
|
29
30
|
messages: [{
|
|
30
31
|
value: JSON.stringify(data),
|
|
31
|
-
key:
|
|
32
|
+
key: messageKey,
|
|
32
33
|
timestamp: Date.now().toString()
|
|
33
34
|
}],
|
|
34
35
|
});
|
|
@@ -36,6 +37,7 @@ class Publisher {
|
|
|
36
37
|
topic: this.topic,
|
|
37
38
|
partition: (_a = result[0]) === null || _a === void 0 ? void 0 : _a.partition,
|
|
38
39
|
offset: (_b = result[0]) === null || _b === void 0 ? void 0 : _b.offset,
|
|
40
|
+
key: (messageKey === null || messageKey === void 0 ? void 0 : messageKey.toString()) || 'none',
|
|
39
41
|
data: JSON.stringify(data).substring(0, 200) // First 200 chars for brevity
|
|
40
42
|
});
|
|
41
43
|
return; // Success, exit retry loop
|