wsp-ms-core 1.1.31 → 1.1.32
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/index.cjs +0 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +0 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2081,58 +2081,32 @@ var KafkaManager = class extends EventManager {
|
|
|
2081
2081
|
autoCommit: false,
|
|
2082
2082
|
// @ts-ignore
|
|
2083
2083
|
eachMessage: async ({ topic, partition, message, heartbeat }) => {
|
|
2084
|
-
console.log("[KafkaManager] A - eachMessage START", {
|
|
2085
|
-
topic,
|
|
2086
|
-
partition,
|
|
2087
|
-
offset: message.offset
|
|
2088
|
-
});
|
|
2089
2084
|
try {
|
|
2090
|
-
console.log("[KafkaManager] B - before execCallback(_onMessage)");
|
|
2091
2085
|
await this.execCallback(
|
|
2092
2086
|
this._onMessage,
|
|
2093
2087
|
`[New message detected for ${topic}]: ${message.value?.toString()}`
|
|
2094
2088
|
);
|
|
2095
|
-
console.log("[KafkaManager] C - after execCallback(_onMessage)");
|
|
2096
|
-
console.log("[KafkaManager] D - before JSON.parse");
|
|
2097
2089
|
const json = JSON.parse(message.value.toString());
|
|
2098
|
-
console.log("[KafkaManager] E - after JSON.parse");
|
|
2099
2090
|
if (!json.data) {
|
|
2100
2091
|
json.data = {};
|
|
2101
2092
|
}
|
|
2102
|
-
console.log("[KafkaManager] F - before EventMessage creation");
|
|
2103
2093
|
const event = {
|
|
2104
2094
|
topic: String(topic),
|
|
2105
2095
|
producer: String(json.producer),
|
|
2106
2096
|
tenant: UUID.create(String(json.tenant)),
|
|
2107
2097
|
message: json.data
|
|
2108
2098
|
};
|
|
2109
|
-
console.log("[KafkaManager] G - EventMessage created");
|
|
2110
2099
|
const execRouteStart = Date.now();
|
|
2111
|
-
console.log("[KafkaManager] H - before execRoute", {
|
|
2112
|
-
offset: message.offset
|
|
2113
|
-
});
|
|
2114
2100
|
const stopHeartbeatLoop = this.startHeartbeatLoop(heartbeat);
|
|
2115
2101
|
try {
|
|
2116
2102
|
await this.execRoute(topic, event);
|
|
2117
2103
|
} finally {
|
|
2118
2104
|
stopHeartbeatLoop();
|
|
2119
2105
|
}
|
|
2120
|
-
console.log("[KafkaManager] I - after execRoute", {
|
|
2121
|
-
elapsedMs: Date.now() - execRouteStart
|
|
2122
|
-
});
|
|
2123
2106
|
const commitStart = Date.now();
|
|
2124
|
-
console.log("[KafkaManager] J - before commitMessage");
|
|
2125
2107
|
await this.commitMessage(topic, partition, message);
|
|
2126
|
-
console.log("[KafkaManager] K - after commitMessage", {
|
|
2127
|
-
elapsedMs: Date.now() - commitStart
|
|
2128
|
-
});
|
|
2129
2108
|
const hbStart = Date.now();
|
|
2130
|
-
console.log("[KafkaManager] L - before heartbeat");
|
|
2131
2109
|
await heartbeat();
|
|
2132
|
-
console.log("[KafkaManager] M - after heartbeat", {
|
|
2133
|
-
elapsedMs: Date.now() - hbStart
|
|
2134
|
-
});
|
|
2135
|
-
console.log("[KafkaManager] N - eachMessage END");
|
|
2136
2110
|
} catch (error) {
|
|
2137
2111
|
console.error("[KafkaManager] ERROR inside eachMessage", {
|
|
2138
2112
|
topic,
|
|
@@ -2233,14 +2207,12 @@ var _MysqlConnector = class _MysqlConnector {
|
|
|
2233
2207
|
return rows;
|
|
2234
2208
|
}
|
|
2235
2209
|
async getConnection() {
|
|
2236
|
-
console.log("[MysqlConnector] BEFORE pool.getConnection");
|
|
2237
2210
|
const conn = await Promise.race([
|
|
2238
2211
|
this._pool.getConnection(),
|
|
2239
2212
|
new Promise(
|
|
2240
2213
|
(_, reject) => setTimeout(() => reject(new Error("pool.getConnection timeout")), 1e4)
|
|
2241
2214
|
)
|
|
2242
2215
|
]);
|
|
2243
|
-
console.log("[MysqlConnector] AFTER pool.getConnection");
|
|
2244
2216
|
return this.wrap(conn);
|
|
2245
2217
|
}
|
|
2246
2218
|
async closePool() {
|
|
@@ -2451,18 +2423,12 @@ var DefaultMysqlInboxRunner = class {
|
|
|
2451
2423
|
for (let topic of this.topics) {
|
|
2452
2424
|
try {
|
|
2453
2425
|
this.eventManager.route(topic, async (e) => {
|
|
2454
|
-
console.log("[InboxRunner] BEFORE getConnection");
|
|
2455
2426
|
const connection = await this.databaseConnector.getConnection();
|
|
2456
|
-
console.log("[InboxRunner] AFTER getConnection");
|
|
2457
2427
|
try {
|
|
2458
2428
|
const repository = new InboxMysqlRepository(connection);
|
|
2459
|
-
console.log("[InboxRunner] BEFORE saveEvent");
|
|
2460
2429
|
await this.saveEvent(e, repository);
|
|
2461
|
-
console.log("[InboxRunner] AFTER saveEvent");
|
|
2462
2430
|
} finally {
|
|
2463
|
-
console.log("[InboxRunner] BEFORE connection.close");
|
|
2464
2431
|
await connection.close();
|
|
2465
|
-
console.log("[InboxRunner] AFTER connection.close");
|
|
2466
2432
|
}
|
|
2467
2433
|
});
|
|
2468
2434
|
} catch (error) {
|