@boxitworld/commons-backend 1.0.0 โ 1.0.2
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.
- package/dist/classes/Publisher.d.ts +8 -8
- package/dist/classes/Publisher.d.ts.map +1 -1
- package/dist/classes/Publisher.js +91 -55
- package/dist/classes/Publisher.js.map +1 -1
- package/dist/classes/SimplePublisher.d.ts +17 -0
- package/dist/classes/SimplePublisher.d.ts.map +1 -0
- package/dist/classes/SimplePublisher.js +104 -0
- package/dist/classes/SimplePublisher.js.map +1 -0
- package/dist/topics/topics.d.ts +1 -0
- package/dist/topics/topics.d.ts.map +1 -1
- package/dist/topics/topics.js +1 -0
- package/dist/topics/topics.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,32 +2,32 @@ import { Kafka } from 'kafkajs';
|
|
|
2
2
|
import { BaseEvent, TypedEvent } from '../types/kafka.types';
|
|
3
3
|
export declare abstract class Publisher<T extends BaseEvent> {
|
|
4
4
|
abstract topic: T['topic'];
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private isConnected;
|
|
5
|
+
private producerPool;
|
|
6
|
+
private clientId;
|
|
8
7
|
private publishStats;
|
|
9
|
-
constructor(kafka: Kafka);
|
|
10
|
-
private
|
|
8
|
+
constructor(kafka: Kafka, clientId?: string);
|
|
9
|
+
private getProducer;
|
|
11
10
|
publish(data: T['data'], keyKafka: T['keyKafka'], headers?: Record<string, string>): Promise<string>;
|
|
12
11
|
publishBatch(messages: Array<{
|
|
13
12
|
data: T['data'];
|
|
14
13
|
keyKafka: T['keyKafka'];
|
|
15
14
|
headers?: Record<string, string>;
|
|
16
15
|
}>): Promise<string[]>;
|
|
17
|
-
|
|
16
|
+
release(): void;
|
|
18
17
|
getPublishStats(): {
|
|
19
18
|
topic: T["topic"];
|
|
19
|
+
clientId: string;
|
|
20
20
|
successful: number;
|
|
21
21
|
failed: number;
|
|
22
22
|
total: number;
|
|
23
23
|
successRate: string;
|
|
24
24
|
lastPublish: string;
|
|
25
|
-
isConnected: boolean;
|
|
26
25
|
};
|
|
27
26
|
resetStats(): void;
|
|
27
|
+
static shutdownPool(): Promise<void>;
|
|
28
28
|
}
|
|
29
29
|
export declare class GenericPublisher extends Publisher<TypedEvent> {
|
|
30
30
|
topic: string;
|
|
31
|
-
constructor(kafka: Kafka, topic: string);
|
|
31
|
+
constructor(kafka: Kafka, topic: string, clientId?: string);
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=Publisher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Publisher.d.ts","sourceRoot":"","sources":["../../src/classes/Publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Publisher.d.ts","sourceRoot":"","sources":["../../src/classes/Publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAuG7D,8BAAsB,SAAS,CAAC,CAAC,SAAS,SAAS;IACjD,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAIlB;gBAEU,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM;YAQ7B,WAAW;IAOnB,OAAO,CACX,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EACf,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,EACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC;IA0DZ,YAAY,CAChB,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QAChB,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC,GACD,OAAO,CAAC,MAAM,EAAE,CAAC;IAiDpB,OAAO,IAAI,IAAI;IAOf,eAAe;;;;;;;;;IAiBf,UAAU,IAAI,IAAI;WAWL,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAM3C;AAKD,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,UAAU,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAI3D"}
|
|
@@ -1,43 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GenericPublisher = exports.Publisher = void 0;
|
|
4
|
-
class
|
|
4
|
+
class ProducerPool {
|
|
5
5
|
constructor(kafka) {
|
|
6
|
-
this.
|
|
7
|
-
this.isConnected = false;
|
|
8
|
-
this.publishStats = {
|
|
9
|
-
successful: 0,
|
|
10
|
-
failed: 0,
|
|
11
|
-
lastPublish: 0
|
|
12
|
-
};
|
|
6
|
+
this.producers = new Map();
|
|
13
7
|
this.kafka = kafka;
|
|
8
|
+
setInterval(() => this.cleanup(), 5 * 60 * 1000);
|
|
9
|
+
}
|
|
10
|
+
static getInstance(kafka) {
|
|
11
|
+
if (!ProducerPool.instance) {
|
|
12
|
+
ProducerPool.instance = new ProducerPool(kafka);
|
|
13
|
+
}
|
|
14
|
+
return ProducerPool.instance;
|
|
15
|
+
}
|
|
16
|
+
async getProducer(clientId) {
|
|
17
|
+
const existing = this.producers.get(clientId);
|
|
18
|
+
if (existing) {
|
|
19
|
+
existing.refCount++;
|
|
20
|
+
existing.lastUsed = Date.now();
|
|
21
|
+
return existing.producer;
|
|
22
|
+
}
|
|
23
|
+
const producer = this.kafka.producer({
|
|
24
|
+
allowAutoTopicCreation: false,
|
|
25
|
+
maxInFlightRequests: 5,
|
|
26
|
+
idempotent: true,
|
|
27
|
+
transactionTimeout: 30000,
|
|
28
|
+
});
|
|
29
|
+
await producer.connect();
|
|
30
|
+
this.producers.set(clientId, {
|
|
31
|
+
producer,
|
|
32
|
+
refCount: 1,
|
|
33
|
+
lastUsed: Date.now()
|
|
34
|
+
});
|
|
35
|
+
console.log(`โ
New producer created and pooled: ${clientId}`);
|
|
36
|
+
return producer;
|
|
14
37
|
}
|
|
15
|
-
|
|
16
|
-
|
|
38
|
+
releaseProducer(clientId) {
|
|
39
|
+
const existing = this.producers.get(clientId);
|
|
40
|
+
if (existing) {
|
|
41
|
+
existing.refCount--;
|
|
42
|
+
existing.lastUsed = Date.now();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async cleanup() {
|
|
46
|
+
const now = Date.now();
|
|
47
|
+
const timeout = 10 * 60 * 1000;
|
|
48
|
+
for (const [clientId, { producer, refCount, lastUsed }] of this.producers) {
|
|
49
|
+
if (refCount === 0 && (now - lastUsed) > timeout) {
|
|
50
|
+
try {
|
|
51
|
+
await producer.disconnect();
|
|
52
|
+
this.producers.delete(clientId);
|
|
53
|
+
console.log(`๐งน Producer cleaned up: ${clientId}`);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error(`๐ฅ Error cleaning up producer ${clientId}:`, error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async shutdown() {
|
|
62
|
+
console.log('๐ Shutting down producer pool...');
|
|
63
|
+
for (const [clientId, { producer }] of this.producers) {
|
|
17
64
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
maxInFlightRequests: 1,
|
|
21
|
-
idempotent: true,
|
|
22
|
-
transactionTimeout: 30000,
|
|
23
|
-
});
|
|
24
|
-
await this.producer.connect();
|
|
25
|
-
this.isConnected = true;
|
|
26
|
-
console.log(`โ
Producer connected for topic: ${this.topic}`);
|
|
65
|
+
await producer.disconnect();
|
|
66
|
+
console.log(`๐ Producer disconnected: ${clientId}`);
|
|
27
67
|
}
|
|
28
68
|
catch (error) {
|
|
29
|
-
console.error(`๐ฅ
|
|
30
|
-
throw error;
|
|
69
|
+
console.error(`๐ฅ Error disconnecting producer ${clientId}:`, error);
|
|
31
70
|
}
|
|
32
71
|
}
|
|
72
|
+
this.producers.clear();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class Publisher {
|
|
76
|
+
constructor(kafka, clientId) {
|
|
77
|
+
this.publishStats = {
|
|
78
|
+
successful: 0,
|
|
79
|
+
failed: 0,
|
|
80
|
+
lastPublish: 0
|
|
81
|
+
};
|
|
82
|
+
this.clientId = clientId || `publisher-${this.constructor.name}-${Date.now()}`;
|
|
83
|
+
this.producerPool = ProducerPool.getInstance(kafka);
|
|
84
|
+
}
|
|
85
|
+
async getProducer() {
|
|
86
|
+
return await this.producerPool.getProducer(this.clientId);
|
|
33
87
|
}
|
|
34
88
|
async publish(data, keyKafka, headers) {
|
|
35
89
|
const messageId = `${this.topic}:${keyKafka}:${Date.now()}`;
|
|
36
90
|
try {
|
|
37
|
-
await this.
|
|
38
|
-
if (!this.producer) {
|
|
39
|
-
throw new Error('Producer not available');
|
|
40
|
-
}
|
|
91
|
+
const producer = await this.getProducer();
|
|
41
92
|
const message = {
|
|
42
93
|
key: String(keyKafka),
|
|
43
94
|
value: JSON.stringify({
|
|
@@ -52,7 +103,7 @@ class Publisher {
|
|
|
52
103
|
...headers
|
|
53
104
|
}
|
|
54
105
|
};
|
|
55
|
-
const result = await
|
|
106
|
+
const result = await producer.send({
|
|
56
107
|
topic: this.topic,
|
|
57
108
|
messages: [message],
|
|
58
109
|
});
|
|
@@ -73,21 +124,12 @@ class Publisher {
|
|
|
73
124
|
key: keyKafka,
|
|
74
125
|
error: error instanceof Error ? error.message : error
|
|
75
126
|
});
|
|
76
|
-
if (error instanceof Error &&
|
|
77
|
-
(error.message.includes('Connection') || error.message.includes('timeout'))) {
|
|
78
|
-
console.log(`๐ Attempting to reconnect producer for ${this.topic}`);
|
|
79
|
-
this.isConnected = false;
|
|
80
|
-
this.producer = null;
|
|
81
|
-
}
|
|
82
127
|
throw new Error(`Failed to publish to ${this.topic}: ${error instanceof Error ? error.message : error}`);
|
|
83
128
|
}
|
|
84
129
|
}
|
|
85
130
|
async publishBatch(messages) {
|
|
86
131
|
try {
|
|
87
|
-
await this.
|
|
88
|
-
if (!this.producer) {
|
|
89
|
-
throw new Error('Producer not available');
|
|
90
|
-
}
|
|
132
|
+
const producer = await this.getProducer();
|
|
91
133
|
const kafkaMessages = messages.map(({ data, keyKafka, headers }) => {
|
|
92
134
|
const messageId = `${this.topic}:${keyKafka}:${Date.now()}`;
|
|
93
135
|
return {
|
|
@@ -105,7 +147,7 @@ class Publisher {
|
|
|
105
147
|
}
|
|
106
148
|
};
|
|
107
149
|
});
|
|
108
|
-
const result = await
|
|
150
|
+
const result = await producer.send({
|
|
109
151
|
topic: this.topic,
|
|
110
152
|
messages: kafkaMessages,
|
|
111
153
|
});
|
|
@@ -124,32 +166,20 @@ class Publisher {
|
|
|
124
166
|
throw new Error(`Failed to publish batch to ${this.topic}: ${error instanceof Error ? error.message : error}`);
|
|
125
167
|
}
|
|
126
168
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
try {
|
|
130
|
-
await this.producer.disconnect();
|
|
131
|
-
console.log(`๐ Producer disconnected for topic: ${this.topic}`);
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
console.error(`๐ฅ Error disconnecting producer for ${this.topic}:`, error);
|
|
135
|
-
}
|
|
136
|
-
finally {
|
|
137
|
-
this.isConnected = false;
|
|
138
|
-
this.producer = null;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
169
|
+
release() {
|
|
170
|
+
this.producerPool.releaseProducer(this.clientId);
|
|
141
171
|
}
|
|
142
172
|
getPublishStats() {
|
|
143
173
|
return {
|
|
144
174
|
topic: this.topic,
|
|
175
|
+
clientId: this.clientId,
|
|
145
176
|
successful: this.publishStats.successful,
|
|
146
177
|
failed: this.publishStats.failed,
|
|
147
178
|
total: this.publishStats.successful + this.publishStats.failed,
|
|
148
179
|
successRate: this.publishStats.successful + this.publishStats.failed > 0
|
|
149
180
|
? (this.publishStats.successful / (this.publishStats.successful + this.publishStats.failed) * 100).toFixed(2) + '%'
|
|
150
181
|
: '0%',
|
|
151
|
-
lastPublish: this.publishStats.lastPublish ? new Date(this.publishStats.lastPublish).toISOString() : 'Never'
|
|
152
|
-
isConnected: this.isConnected
|
|
182
|
+
lastPublish: this.publishStats.lastPublish ? new Date(this.publishStats.lastPublish).toISOString() : 'Never'
|
|
153
183
|
};
|
|
154
184
|
}
|
|
155
185
|
resetStats() {
|
|
@@ -159,11 +189,17 @@ class Publisher {
|
|
|
159
189
|
lastPublish: 0
|
|
160
190
|
};
|
|
161
191
|
}
|
|
192
|
+
static async shutdownPool() {
|
|
193
|
+
const instance = ProducerPool.instance;
|
|
194
|
+
if (instance) {
|
|
195
|
+
await instance.shutdown();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
162
198
|
}
|
|
163
199
|
exports.Publisher = Publisher;
|
|
164
200
|
class GenericPublisher extends Publisher {
|
|
165
|
-
constructor(kafka, topic) {
|
|
166
|
-
super(kafka);
|
|
201
|
+
constructor(kafka, topic, clientId) {
|
|
202
|
+
super(kafka, clientId);
|
|
167
203
|
this.topic = topic;
|
|
168
204
|
}
|
|
169
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Publisher.js","sourceRoot":"","sources":["../../src/classes/Publisher.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Publisher.js","sourceRoot":"","sources":["../../src/classes/Publisher.ts"],"names":[],"mappings":";;;AAMA,MAAM,YAAY;IAKhB,YAA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CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO;SAC7G,CAAC;IACJ,CAAC;IAKD,UAAU;QACR,IAAI,CAAC,YAAY,GAAG;YAClB,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,CAAC;YACT,WAAW,EAAE,CAAC;SACf,CAAC;IACJ,CAAC;IAKD,MAAM,CAAC,KAAK,CAAC,YAAY;QACvB,MAAM,QAAQ,GAAI,YAAoB,CAAC,QAAQ,CAAC;QAChD,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAxLD,8BAwLC;AAKD,MAAa,gBAAiB,SAAQ,SAAqB;IAGzD,YAAY,KAAY,EAAE,KAAa,EAAE,QAAiB;QACxD,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAPD,4CAOC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Kafka } from 'kafkajs';
|
|
2
|
+
import { BaseEvent } from '../types/kafka.types';
|
|
3
|
+
export declare abstract class SimplePublisher<T extends BaseEvent> {
|
|
4
|
+
abstract topic: T['topic'];
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: Kafka);
|
|
7
|
+
publish(data: T['data'], keyKafka: T['keyKafka']): Promise<string>;
|
|
8
|
+
publishBatch(messages: Array<{
|
|
9
|
+
data: T['data'];
|
|
10
|
+
keyKafka: T['keyKafka'];
|
|
11
|
+
}>): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
export declare class GenericSimplePublisher extends SimplePublisher<BaseEvent> {
|
|
14
|
+
topic: string;
|
|
15
|
+
constructor(client: Kafka, topic: string);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=SimplePublisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimplePublisher.d.ts","sourceRoot":"","sources":["../../src/classes/SimplePublisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAgBjD,8BAAsB,eAAe,CAAC,CAAC,SAAS,SAAS;IACvD,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,KAAK;IAQzB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAqDlE,YAAY,CACV,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QAChB,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;KACzB,CAAC,GACD,OAAO,CAAC,MAAM,CAAC;CAiDnB;AAKD,qBAAa,sBAAuB,SAAQ,eAAe,CAAC,SAAS,CAAC;IACpE,KAAK,EAAE,MAAM,CAAC;gBAEF,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;CAIzC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenericSimplePublisher = exports.SimplePublisher = void 0;
|
|
4
|
+
class SimplePublisher {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
publish(data, keyKafka) {
|
|
9
|
+
const topic = this.topic;
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
const producer = this.client.producer();
|
|
12
|
+
try {
|
|
13
|
+
(async () => {
|
|
14
|
+
try {
|
|
15
|
+
await producer.connect();
|
|
16
|
+
await producer.send({
|
|
17
|
+
topic,
|
|
18
|
+
messages: [
|
|
19
|
+
{
|
|
20
|
+
key: String(keyKafka),
|
|
21
|
+
value: JSON.stringify({
|
|
22
|
+
data,
|
|
23
|
+
timestamp: Date.now(),
|
|
24
|
+
topic
|
|
25
|
+
})
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
console.log(`๐ค Message sent to ${topic} with key ${keyKafka}`);
|
|
30
|
+
resolve(`${topic} done`);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error(`๐ฅ Error publishing to ${topic}:`, error);
|
|
34
|
+
reject(`${topic} ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
try {
|
|
38
|
+
await producer.disconnect();
|
|
39
|
+
}
|
|
40
|
+
catch (disconnectError) {
|
|
41
|
+
console.warn(`โ ๏ธ Warning: Error disconnecting producer for ${topic}:`, disconnectError);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
}
|
|
46
|
+
catch (syncError) {
|
|
47
|
+
console.error(`๐ฅ Sync error in ${topic}:`, syncError);
|
|
48
|
+
reject(`${topic} ${syncError instanceof Error ? syncError.message : 'Sync error'}`);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
publishBatch(messages) {
|
|
53
|
+
const topic = this.topic;
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const producer = this.client.producer();
|
|
56
|
+
try {
|
|
57
|
+
(async () => {
|
|
58
|
+
try {
|
|
59
|
+
await producer.connect();
|
|
60
|
+
const kafkaMessages = messages.map(({ data, keyKafka }) => ({
|
|
61
|
+
key: String(keyKafka),
|
|
62
|
+
value: JSON.stringify({
|
|
63
|
+
data,
|
|
64
|
+
timestamp: Date.now(),
|
|
65
|
+
topic
|
|
66
|
+
})
|
|
67
|
+
}));
|
|
68
|
+
await producer.send({
|
|
69
|
+
topic,
|
|
70
|
+
messages: kafkaMessages,
|
|
71
|
+
});
|
|
72
|
+
console.log(`๐ค Batch sent to ${topic}: ${messages.length} messages`);
|
|
73
|
+
resolve(`${topic} batch done (${messages.length} messages)`);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error(`๐ฅ Error publishing batch to ${topic}:`, error);
|
|
77
|
+
reject(`${topic} batch error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
await producer.disconnect();
|
|
82
|
+
}
|
|
83
|
+
catch (disconnectError) {
|
|
84
|
+
console.warn(`โ ๏ธ Warning: Error disconnecting producer for ${topic}:`, disconnectError);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})();
|
|
88
|
+
}
|
|
89
|
+
catch (syncError) {
|
|
90
|
+
console.error(`๐ฅ Sync error in batch ${topic}:`, syncError);
|
|
91
|
+
reject(`${topic} batch sync error: ${syncError instanceof Error ? syncError.message : 'Sync error'}`);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.SimplePublisher = SimplePublisher;
|
|
97
|
+
class GenericSimplePublisher extends SimplePublisher {
|
|
98
|
+
constructor(client, topic) {
|
|
99
|
+
super(client);
|
|
100
|
+
this.topic = topic;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.GenericSimplePublisher = GenericSimplePublisher;
|
|
104
|
+
//# sourceMappingURL=SimplePublisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimplePublisher.js","sourceRoot":"","sources":["../../src/classes/SimplePublisher.ts"],"names":[],"mappings":";;;AAiBA,MAAsB,eAAe;IAKnC,YAAY,MAAa;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAMD,OAAO,CAAC,IAAe,EAAE,QAAuB;QAC9C,M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file":"topics.d.ts","sourceRoot":"","sources":["../../src/topics/topics.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACrB,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;IACzB,YAAY,iBAAiB;CAChC"}
|
package/dist/topics/topics.js
CHANGED
|
@@ -6,6 +6,7 @@ var ActionsTopics;
|
|
|
6
6
|
ActionsTopics["ACTION_CREATED"] = "action.created";
|
|
7
7
|
ActionsTopics["LOG_CREATED"] = "log.created";
|
|
8
8
|
ActionsTopics["SYSTEM_INFO"] = "system.info";
|
|
9
|
+
ActionsTopics["SYSTEM_MONITORING"] = "system.monitoring";
|
|
9
10
|
ActionsTopics["BATCH_SYNC"] = "batch.sync";
|
|
10
11
|
ActionsTopics["PLATFORM_LOG"] = "platform.log";
|
|
11
12
|
})(ActionsTopics || (exports.ActionsTopics = ActionsTopics = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topics.js","sourceRoot":"","sources":["../../src/topics/topics.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"topics.js","sourceRoot":"","sources":["../../src/topics/topics.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAOX;AAPD,WAAY,aAAa;IACrB,kDAAiC,CAAA;IACjC,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;IAC3B,wDAAuC,CAAA;IACvC,0CAAyB,CAAA;IACzB,8CAA6B,CAAA;AACjC,CAAC,EAPW,aAAa,6BAAb,aAAa,QAOxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxitworld/commons-backend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Common interfaces and functions for BoxitWorld backend applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"test:watch": "jest --watch",
|
|
19
19
|
"lint": "eslint src/**/*.ts",
|
|
20
20
|
"lint:fix": "eslint src/**/*.ts --fix",
|
|
21
|
-
"pub": "npm publish"
|
|
21
|
+
"pub": "npm version patch & npm publish"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"boxitworld",
|