@loipv/nestjs-kafka 0.0.3 → 0.0.5-beta.1
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/README.md +105 -0
- package/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/index.js +3 -1
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/inject-kafka-client.decorator.d.ts +1 -0
- package/dist/decorators/inject-kafka-client.decorator.js +9 -0
- package/dist/decorators/inject-kafka-client.decorator.js.map +1 -0
- package/dist/discovery/consumer-discovery.service.js +5 -1
- package/dist/discovery/consumer-discovery.service.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/consumer-options.interface.d.ts +2 -0
- package/dist/interfaces/kafka-module-options.interface.d.ts +6 -0
- package/dist/interfaces/kafka-module-options.interface.js +14 -1
- package/dist/interfaces/kafka-module-options.interface.js.map +1 -1
- package/dist/kafka.module.d.ts +9 -2
- package/dist/kafka.module.js +161 -35
- package/dist/kafka.module.js.map +1 -1
- package/dist/services/consumer-registry.service.d.ts +5 -4
- package/dist/services/consumer-registry.service.js +165 -90
- package/dist/services/consumer-registry.service.js.map +1 -1
- package/dist/services/kafka-client.service.d.ts +28 -17
- package/dist/services/kafka-client.service.js +101 -68
- package/dist/services/kafka-client.service.js.map +1 -1
- package/dist/services/kafka-core.service.d.ts +11 -9
- package/dist/services/kafka-core.service.js +84 -34
- package/dist/services/kafka-core.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -8,58 +8,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
var KafkaClient_1;
|
|
15
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.KafkaClient = void 0;
|
|
13
|
+
exports.ConnectionBoundClient = exports.KafkaClient = void 0;
|
|
17
14
|
const common_1 = require("@nestjs/common");
|
|
18
15
|
const interfaces_1 = require("../interfaces");
|
|
19
16
|
const kafka_core_service_1 = require("./kafka-core.service");
|
|
20
17
|
let KafkaClient = KafkaClient_1 = class KafkaClient {
|
|
21
|
-
options;
|
|
22
18
|
kafkaCore;
|
|
23
19
|
logger = new common_1.Logger(KafkaClient_1.name);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
batchBuffer = new Map();
|
|
27
|
-
batchTimer = null;
|
|
20
|
+
batchBuffers = new Map();
|
|
21
|
+
batchTimers = new Map();
|
|
28
22
|
defaultBatchSize = 100;
|
|
29
23
|
defaultBatchTimeout = 100;
|
|
30
|
-
constructor(
|
|
31
|
-
this.options = options;
|
|
24
|
+
constructor(kafkaCore) {
|
|
32
25
|
this.kafkaCore = kafkaCore;
|
|
33
26
|
}
|
|
34
|
-
async onModuleInit() {
|
|
35
|
-
this.producer = this.kafkaCore.getKafka().producer(this.options.producer);
|
|
36
|
-
await this.connect();
|
|
37
|
-
}
|
|
38
27
|
async onApplicationShutdown() {
|
|
39
|
-
await this.disconnect();
|
|
40
|
-
}
|
|
41
|
-
async connect() {
|
|
42
|
-
if (this.isConnected)
|
|
43
|
-
return;
|
|
44
|
-
try {
|
|
45
|
-
await this.producer.connect();
|
|
46
|
-
this.isConnected = true;
|
|
47
|
-
this.logger.log('Kafka producer connected');
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
this.logger.error('Failed to connect Kafka producer', error);
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async disconnect() {
|
|
55
28
|
await this.flushAllBatches();
|
|
56
|
-
|
|
57
|
-
await this.producer.disconnect();
|
|
58
|
-
this.isConnected = false;
|
|
59
|
-
this.logger.log('Kafka producer disconnected');
|
|
60
|
-
}
|
|
29
|
+
await this.kafkaCore.disconnectAll();
|
|
61
30
|
}
|
|
62
31
|
async send(topic, message, options) {
|
|
32
|
+
const connectionName = options?.connection || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
33
|
+
await this.kafkaCore.connectProducer(connectionName);
|
|
63
34
|
const kafkaMessage = this.serializeMessage(message);
|
|
64
35
|
const record = {
|
|
65
36
|
topic,
|
|
@@ -69,15 +40,18 @@ let KafkaClient = KafkaClient_1 = class KafkaClient {
|
|
|
69
40
|
compression: options?.compression,
|
|
70
41
|
};
|
|
71
42
|
try {
|
|
72
|
-
|
|
73
|
-
|
|
43
|
+
const producer = this.kafkaCore.getProducer(connectionName);
|
|
44
|
+
await producer.send(record);
|
|
45
|
+
this.logger.debug(`[${connectionName}] Message sent to topic: ${topic}`);
|
|
74
46
|
}
|
|
75
47
|
catch (error) {
|
|
76
|
-
this.logger.error(`Failed to send message to topic: ${topic}`, error);
|
|
48
|
+
this.logger.error(`[${connectionName}] Failed to send message to topic: ${topic}`, error);
|
|
77
49
|
throw error;
|
|
78
50
|
}
|
|
79
51
|
}
|
|
80
52
|
async sendBatch(topic, messages, options) {
|
|
53
|
+
const connectionName = options?.connection || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
54
|
+
await this.kafkaCore.connectProducer(connectionName);
|
|
81
55
|
const kafkaMessages = messages.map((msg) => this.serializeMessage(msg));
|
|
82
56
|
const record = {
|
|
83
57
|
topic,
|
|
@@ -87,15 +61,18 @@ let KafkaClient = KafkaClient_1 = class KafkaClient {
|
|
|
87
61
|
compression: options?.compression,
|
|
88
62
|
};
|
|
89
63
|
try {
|
|
90
|
-
|
|
91
|
-
|
|
64
|
+
const producer = this.kafkaCore.getProducer(connectionName);
|
|
65
|
+
await producer.send(record);
|
|
66
|
+
this.logger.debug(`[${connectionName}] Batch of ${messages.length} messages sent to topic: ${topic}`);
|
|
92
67
|
}
|
|
93
68
|
catch (error) {
|
|
94
|
-
this.logger.error(`Failed to send batch to topic: ${topic}`, error);
|
|
69
|
+
this.logger.error(`[${connectionName}] Failed to send batch to topic: ${topic}`, error);
|
|
95
70
|
throw error;
|
|
96
71
|
}
|
|
97
72
|
}
|
|
98
73
|
async sendMultiTopicBatch(topicMessages, options) {
|
|
74
|
+
const connectionName = options?.connection || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
75
|
+
await this.kafkaCore.connectProducer(connectionName);
|
|
99
76
|
const batch = {
|
|
100
77
|
topicMessages: topicMessages.map(({ topic, messages }) => ({
|
|
101
78
|
topic,
|
|
@@ -106,28 +83,41 @@ let KafkaClient = KafkaClient_1 = class KafkaClient {
|
|
|
106
83
|
compression: options?.compression,
|
|
107
84
|
};
|
|
108
85
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
86
|
+
const producer = this.kafkaCore.getProducer(connectionName);
|
|
87
|
+
await producer.sendBatch(batch);
|
|
88
|
+
this.logger.debug(`[${connectionName}] Multi-topic batch sent to ${topicMessages.length} topics`);
|
|
111
89
|
}
|
|
112
90
|
catch (error) {
|
|
113
|
-
this.logger.error(
|
|
91
|
+
this.logger.error(`[${connectionName}] Failed to send multi-topic batch`, error);
|
|
114
92
|
throw error;
|
|
115
93
|
}
|
|
116
94
|
}
|
|
117
|
-
async sendQueued(topic, message) {
|
|
95
|
+
async sendQueued(topic, message, connection) {
|
|
96
|
+
const connectionName = connection || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
97
|
+
await this.kafkaCore.connectProducer(connectionName);
|
|
118
98
|
const kafkaMessage = this.serializeMessage(message);
|
|
119
|
-
if (!this.
|
|
120
|
-
this.
|
|
99
|
+
if (!this.batchBuffers.has(connectionName)) {
|
|
100
|
+
this.batchBuffers.set(connectionName, new Map());
|
|
121
101
|
}
|
|
122
|
-
this.
|
|
123
|
-
|
|
102
|
+
const connectionBuffer = this.batchBuffers.get(connectionName);
|
|
103
|
+
if (!connectionBuffer.has(topic)) {
|
|
104
|
+
connectionBuffer.set(topic, []);
|
|
105
|
+
}
|
|
106
|
+
connectionBuffer.get(topic).push(kafkaMessage);
|
|
107
|
+
const buffer = connectionBuffer.get(topic);
|
|
124
108
|
if (buffer.length >= this.defaultBatchSize) {
|
|
125
|
-
await this.flushBatch(topic);
|
|
109
|
+
await this.flushBatch(connectionName, topic);
|
|
126
110
|
}
|
|
127
111
|
else {
|
|
128
|
-
this.scheduleBatchFlush();
|
|
112
|
+
this.scheduleBatchFlush(connectionName);
|
|
129
113
|
}
|
|
130
114
|
}
|
|
115
|
+
forConnection(name) {
|
|
116
|
+
return new ConnectionBoundClient(this, name);
|
|
117
|
+
}
|
|
118
|
+
isHealthy(connection) {
|
|
119
|
+
return this.kafkaCore.hasConnection(connection);
|
|
120
|
+
}
|
|
131
121
|
serializeMessage(message) {
|
|
132
122
|
let value;
|
|
133
123
|
if (message.value === null || message.value === undefined) {
|
|
@@ -147,37 +137,80 @@ let KafkaClient = KafkaClient_1 = class KafkaClient {
|
|
|
147
137
|
timestamp: message.timestamp,
|
|
148
138
|
};
|
|
149
139
|
}
|
|
150
|
-
scheduleBatchFlush() {
|
|
151
|
-
|
|
140
|
+
scheduleBatchFlush(connectionName) {
|
|
141
|
+
const timerKey = connectionName;
|
|
142
|
+
if (this.batchTimers.has(timerKey))
|
|
152
143
|
return;
|
|
153
|
-
|
|
154
|
-
void this.
|
|
155
|
-
this.
|
|
144
|
+
const timer = setTimeout(() => {
|
|
145
|
+
void this.flushConnectionBatches(connectionName).then(() => {
|
|
146
|
+
this.batchTimers.delete(timerKey);
|
|
156
147
|
});
|
|
157
148
|
}, this.defaultBatchTimeout);
|
|
149
|
+
this.batchTimers.set(timerKey, timer);
|
|
158
150
|
}
|
|
159
|
-
async flushBatch(topic) {
|
|
160
|
-
const
|
|
151
|
+
async flushBatch(connectionName, topic) {
|
|
152
|
+
const connectionBuffer = this.batchBuffers.get(connectionName);
|
|
153
|
+
if (!connectionBuffer)
|
|
154
|
+
return;
|
|
155
|
+
const messages = connectionBuffer.get(topic);
|
|
161
156
|
if (!messages || messages.length === 0)
|
|
162
157
|
return;
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
connectionBuffer.set(topic, []);
|
|
159
|
+
const producer = this.kafkaCore.getProducer(connectionName);
|
|
160
|
+
await producer.send({
|
|
165
161
|
topic,
|
|
166
162
|
messages,
|
|
167
163
|
});
|
|
168
164
|
}
|
|
169
|
-
async
|
|
170
|
-
const
|
|
171
|
-
|
|
165
|
+
async flushConnectionBatches(connectionName) {
|
|
166
|
+
const connectionBuffer = this.batchBuffers.get(connectionName);
|
|
167
|
+
if (!connectionBuffer)
|
|
168
|
+
return;
|
|
169
|
+
const topics = Array.from(connectionBuffer.keys());
|
|
170
|
+
await Promise.all(topics.map((topic) => this.flushBatch(connectionName, topic)));
|
|
172
171
|
}
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
async flushAllBatches() {
|
|
173
|
+
const connections = Array.from(this.batchBuffers.keys());
|
|
174
|
+
await Promise.all(connections.map((conn) => this.flushConnectionBatches(conn)));
|
|
175
|
+
for (const timer of this.batchTimers.values()) {
|
|
176
|
+
clearTimeout(timer);
|
|
177
|
+
}
|
|
178
|
+
this.batchTimers.clear();
|
|
175
179
|
}
|
|
176
180
|
};
|
|
177
181
|
exports.KafkaClient = KafkaClient;
|
|
178
182
|
exports.KafkaClient = KafkaClient = KafkaClient_1 = __decorate([
|
|
179
183
|
(0, common_1.Injectable)(),
|
|
180
|
-
|
|
181
|
-
__metadata("design:paramtypes", [Object, kafka_core_service_1.KafkaCoreService])
|
|
184
|
+
__metadata("design:paramtypes", [kafka_core_service_1.KafkaCoreService])
|
|
182
185
|
], KafkaClient);
|
|
186
|
+
class ConnectionBoundClient {
|
|
187
|
+
client;
|
|
188
|
+
connection;
|
|
189
|
+
constructor(client, connection) {
|
|
190
|
+
this.client = client;
|
|
191
|
+
this.connection = connection;
|
|
192
|
+
}
|
|
193
|
+
async send(topic, message, options) {
|
|
194
|
+
return this.client.send(topic, message, {
|
|
195
|
+
...options,
|
|
196
|
+
connection: this.connection,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
async sendBatch(topic, messages, options) {
|
|
200
|
+
return this.client.sendBatch(topic, messages, {
|
|
201
|
+
...options,
|
|
202
|
+
connection: this.connection,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
async sendMultiTopicBatch(topicMessages, options) {
|
|
206
|
+
return this.client.sendMultiTopicBatch(topicMessages, {
|
|
207
|
+
...options,
|
|
208
|
+
connection: this.connection,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async sendQueued(topic, message) {
|
|
212
|
+
return this.client.sendQueued(topic, message, this.connection);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.ConnectionBoundClient = ConnectionBoundClient;
|
|
183
216
|
//# sourceMappingURL=kafka-client.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kafka-client.service.js","sourceRoot":"","sources":["../../lib/services/kafka-client.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kafka-client.service.js","sourceRoot":"","sources":["../../lib/services/kafka-client.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA2E;AAE3E,8CAIuB;AACvB,6DAAwD;AAQjD,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAQO;IAPZ,MAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAE/C,YAAY,GAAG,IAAI,GAAG,EAAkC,CAAC;IACzD,WAAW,GAAG,IAAI,GAAG,EAA0B,CAAC;IACvC,gBAAgB,GAAG,GAAG,CAAC;IACvB,mBAAmB,GAAG,GAAG,CAAC;IAE3C,YAA6B,SAA2B;QAA3B,cAAS,GAAT,SAAS,CAAkB;IAAG,CAAC;IAE5D,KAAK,CAAC,qBAAqB;QACzB,MAAM,IAAI,CAA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I,CAAC,UAAU;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,aAAoE,EACpE,OAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE;YACpD,GAAG,OAAO;YACV,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAa,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjE,CAAC;CACF;AAzCD,sDAyCC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Kafka } from 'kafkajs';
|
|
1
|
+
import { Kafka, Producer } from 'kafkajs';
|
|
3
2
|
import { KafkaModuleOptions } from '../interfaces';
|
|
4
|
-
export declare class KafkaCoreService
|
|
5
|
-
private readonly options;
|
|
3
|
+
export declare class KafkaCoreService {
|
|
6
4
|
private readonly logger;
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
private connections;
|
|
6
|
+
registerConnection(options: KafkaModuleOptions): void;
|
|
7
|
+
getKafka(name?: string): Kafka;
|
|
8
|
+
getProducer(name?: string): Producer;
|
|
9
|
+
connectProducer(name?: string): Promise<void>;
|
|
10
|
+
getOptions(name?: string): KafkaModuleOptions;
|
|
11
|
+
hasConnection(name?: string): boolean;
|
|
12
|
+
getConnectionNames(): string[];
|
|
13
|
+
disconnectAll(): Promise<void>;
|
|
12
14
|
private mapLogLevel;
|
|
13
15
|
}
|
|
@@ -5,12 +5,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
8
|
var KafkaCoreService_1;
|
|
15
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
10
|
exports.KafkaCoreService = void 0;
|
|
@@ -18,48 +12,106 @@ const common_1 = require("@nestjs/common");
|
|
|
18
12
|
const kafkajs_1 = require("kafkajs");
|
|
19
13
|
const interfaces_1 = require("../interfaces");
|
|
20
14
|
let KafkaCoreService = KafkaCoreService_1 = class KafkaCoreService {
|
|
21
|
-
options;
|
|
22
15
|
logger = new common_1.Logger(KafkaCoreService_1.name);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
16
|
+
connections = new Map();
|
|
17
|
+
registerConnection(options) {
|
|
18
|
+
const name = options.name || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
19
|
+
if (this.connections.has(name)) {
|
|
20
|
+
this.logger.warn(`Kafka connection "${name}" already registered, skipping`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const kafka = new kafkajs_1.Kafka({
|
|
24
|
+
clientId: options.clientId,
|
|
25
|
+
brokers: options.brokers,
|
|
26
|
+
ssl: options.ssl,
|
|
27
|
+
sasl: options.sasl,
|
|
28
|
+
connectionTimeout: options.connectionTimeout,
|
|
29
|
+
requestTimeout: options.requestTimeout,
|
|
30
|
+
enforceRequestTimeout: options.enforceRequestTimeout,
|
|
31
|
+
retry: options.retry,
|
|
32
|
+
logLevel: this.mapLogLevel(options.logLevel),
|
|
38
33
|
logCreator: () => ({ level, log }) => {
|
|
39
34
|
const { message, ...extra } = log;
|
|
40
35
|
switch (level) {
|
|
41
36
|
case kafkajs_1.logLevel.ERROR:
|
|
42
|
-
this.logger.error(message
|
|
37
|
+
this.logger.error(`[${name}] ${message}`, extra);
|
|
43
38
|
break;
|
|
44
39
|
case kafkajs_1.logLevel.WARN:
|
|
45
|
-
this.logger.warn(message
|
|
40
|
+
this.logger.warn(`[${name}] ${message}`, extra);
|
|
46
41
|
break;
|
|
47
42
|
case kafkajs_1.logLevel.INFO:
|
|
48
|
-
this.logger.log(message);
|
|
43
|
+
this.logger.log(`[${name}] ${message}`);
|
|
49
44
|
break;
|
|
50
45
|
case kafkajs_1.logLevel.DEBUG:
|
|
51
|
-
this.logger.debug(message);
|
|
46
|
+
this.logger.debug(`[${name}] ${message}`);
|
|
52
47
|
break;
|
|
53
48
|
}
|
|
54
49
|
},
|
|
55
50
|
});
|
|
56
|
-
|
|
51
|
+
const producer = kafka.producer(options.producer);
|
|
52
|
+
this.connections.set(name, {
|
|
53
|
+
kafka,
|
|
54
|
+
producer,
|
|
55
|
+
options,
|
|
56
|
+
isProducerConnected: false,
|
|
57
|
+
});
|
|
58
|
+
this.logger.log(`Kafka connection "${name}" registered (clientId: ${options.clientId})`);
|
|
57
59
|
}
|
|
58
|
-
getKafka() {
|
|
59
|
-
|
|
60
|
+
getKafka(name) {
|
|
61
|
+
const connectionName = name || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
62
|
+
const connection = this.connections.get(connectionName);
|
|
63
|
+
if (!connection) {
|
|
64
|
+
throw new Error(`Kafka connection "${connectionName}" not found`);
|
|
65
|
+
}
|
|
66
|
+
return connection.kafka;
|
|
67
|
+
}
|
|
68
|
+
getProducer(name) {
|
|
69
|
+
const connectionName = name || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
70
|
+
const connection = this.connections.get(connectionName);
|
|
71
|
+
if (!connection) {
|
|
72
|
+
throw new Error(`Kafka connection "${connectionName}" not found`);
|
|
73
|
+
}
|
|
74
|
+
return connection.producer;
|
|
60
75
|
}
|
|
61
|
-
|
|
62
|
-
|
|
76
|
+
async connectProducer(name) {
|
|
77
|
+
const connectionName = name || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
78
|
+
const connection = this.connections.get(connectionName);
|
|
79
|
+
if (!connection) {
|
|
80
|
+
throw new Error(`Kafka connection "${connectionName}" not found`);
|
|
81
|
+
}
|
|
82
|
+
if (!connection.isProducerConnected) {
|
|
83
|
+
await connection.producer.connect();
|
|
84
|
+
connection.isProducerConnected = true;
|
|
85
|
+
this.logger.log(`Producer connected for "${connectionName}"`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getOptions(name) {
|
|
89
|
+
const connectionName = name || interfaces_1.DEFAULT_KAFKA_CONNECTION;
|
|
90
|
+
const connection = this.connections.get(connectionName);
|
|
91
|
+
if (!connection) {
|
|
92
|
+
throw new Error(`Kafka connection "${connectionName}" not found`);
|
|
93
|
+
}
|
|
94
|
+
return connection.options;
|
|
95
|
+
}
|
|
96
|
+
hasConnection(name) {
|
|
97
|
+
return this.connections.has(name || interfaces_1.DEFAULT_KAFKA_CONNECTION);
|
|
98
|
+
}
|
|
99
|
+
getConnectionNames() {
|
|
100
|
+
return Array.from(this.connections.keys());
|
|
101
|
+
}
|
|
102
|
+
async disconnectAll() {
|
|
103
|
+
for (const [name, connection] of this.connections) {
|
|
104
|
+
try {
|
|
105
|
+
if (connection.isProducerConnected) {
|
|
106
|
+
await connection.producer.disconnect();
|
|
107
|
+
connection.isProducerConnected = false;
|
|
108
|
+
this.logger.log(`Producer disconnected for "${name}"`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
this.logger.error(`Error disconnecting producer for "${name}"`, error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
63
115
|
}
|
|
64
116
|
mapLogLevel(level) {
|
|
65
117
|
switch (level) {
|
|
@@ -80,8 +132,6 @@ let KafkaCoreService = KafkaCoreService_1 = class KafkaCoreService {
|
|
|
80
132
|
};
|
|
81
133
|
exports.KafkaCoreService = KafkaCoreService;
|
|
82
134
|
exports.KafkaCoreService = KafkaCoreService = KafkaCoreService_1 = __decorate([
|
|
83
|
-
(0, common_1.Injectable)()
|
|
84
|
-
__param(0, (0, common_1.Inject)(interfaces_1.KAFKA_MODULE_OPTIONS)),
|
|
85
|
-
__metadata("design:paramtypes", [Object])
|
|
135
|
+
(0, common_1.Injectable)()
|
|
86
136
|
], KafkaCoreService);
|
|
87
137
|
//# sourceMappingURL=kafka-core.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kafka-core.service.js","sourceRoot":"","sources":["../../lib/services/kafka-core.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kafka-core.service.js","sourceRoot":"","sources":["../../lib/services/kafka-core.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,qCAAoD;AACpD,8CAA6E;AAUtE,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IACV,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;IACpD,WAAW,GAAG,IAAI,GAAG,EAA2B,CAAC;IAKzD,kBAAkB,CAAC,OAA2B;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,qCAAwB,CAAC;QAEtD,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,qBAAqB,IAAI,gCAAgC,CAC1D,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,eAAK,CAAC;YACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,OAAO,EAAE,OAAO,CAAC,OA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