tiryaq-shared 1.2.30 → 1.3.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.
Files changed (45) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/kafka/broker-parser.d.ts +54 -0
  6. package/dist/kafka/broker-parser.d.ts.map +1 -0
  7. package/dist/kafka/broker-parser.js +191 -0
  8. package/dist/kafka/broker-parser.js.map +1 -0
  9. package/dist/kafka/circuit-breaker.provider.d.ts +113 -0
  10. package/dist/kafka/circuit-breaker.provider.d.ts.map +1 -0
  11. package/dist/kafka/circuit-breaker.provider.js +230 -0
  12. package/dist/kafka/circuit-breaker.provider.js.map +1 -0
  13. package/dist/kafka/dlq-handler.d.ts +102 -0
  14. package/dist/kafka/dlq-handler.d.ts.map +1 -0
  15. package/dist/kafka/dlq-handler.js +220 -0
  16. package/dist/kafka/dlq-handler.js.map +1 -0
  17. package/dist/kafka/health-check.provider.d.ts +78 -0
  18. package/dist/kafka/health-check.provider.d.ts.map +1 -0
  19. package/dist/kafka/health-check.provider.js +170 -0
  20. package/dist/kafka/health-check.provider.js.map +1 -0
  21. package/dist/kafka/index.d.ts +15 -0
  22. package/dist/kafka/index.d.ts.map +1 -0
  23. package/dist/kafka/index.js +41 -0
  24. package/dist/kafka/index.js.map +1 -0
  25. package/dist/kafka/kafka-config.manager.d.ts +92 -0
  26. package/dist/kafka/kafka-config.manager.d.ts.map +1 -0
  27. package/dist/kafka/kafka-config.manager.js +306 -0
  28. package/dist/kafka/kafka-config.manager.js.map +1 -0
  29. package/dist/kafka/kafka-logger.d.ts +125 -0
  30. package/dist/kafka/kafka-logger.d.ts.map +1 -0
  31. package/dist/kafka/kafka-logger.js +204 -0
  32. package/dist/kafka/kafka-logger.js.map +1 -0
  33. package/dist/kafka/subscription-registry.d.ts +141 -0
  34. package/dist/kafka/subscription-registry.d.ts.map +1 -0
  35. package/dist/kafka/subscription-registry.js +219 -0
  36. package/dist/kafka/subscription-registry.js.map +1 -0
  37. package/dist/kafka/types.d.ts +163 -0
  38. package/dist/kafka/types.d.ts.map +1 -0
  39. package/dist/kafka/types.js +19 -0
  40. package/dist/kafka/types.js.map +1 -0
  41. package/dist/message-patterns.d.ts +2 -0
  42. package/dist/message-patterns.d.ts.map +1 -1
  43. package/dist/message-patterns.js +3 -0
  44. package/dist/message-patterns.js.map +1 -1
  45. package/package.json +1 -1
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Dead Letter Queue Handler
3
+ *
4
+ * Handles messages that fail processing after all retry attempts.
5
+ * Sends failed messages to a service-specific DLQ topic with complete error context.
6
+ *
7
+ * Features:
8
+ * - Service-specific DLQ topics ({service-name}-dlq)
9
+ * - Preserves original message payload and metadata
10
+ * - Includes error details and retry count
11
+ * - Maintains message ordering within partitions
12
+ * - Structured logging for all DLQ operations
13
+ *
14
+ * Note: This implementation requires kafkajs to be installed in the consuming service.
15
+ * Install with: npm install kafkajs
16
+ */
17
+ import { Logger } from '@nestjs/common';
18
+ import { KafkaClientConfig } from './types';
19
+ /**
20
+ * Context information for DLQ operations
21
+ */
22
+ export interface DLQContext {
23
+ topic: string;
24
+ partition: number;
25
+ offset: string;
26
+ retryCount: number;
27
+ }
28
+ /**
29
+ * DeadLetterQueueHandler class manages failed message handling
30
+ *
31
+ * Provides methods to send failed messages to DLQ topics with complete
32
+ * error context and metadata preservation.
33
+ *
34
+ * Requires kafkajs to be installed in the consuming service.
35
+ */
36
+ export declare class DeadLetterQueueHandler {
37
+ private logger;
38
+ private kafkaLogger;
39
+ private producer;
40
+ private serviceName;
41
+ private kafkaConfig;
42
+ private kafka;
43
+ private isConnected;
44
+ private KafkaClass;
45
+ /**
46
+ * Create a new DeadLetterQueueHandler instance
47
+ *
48
+ * @param serviceName - Name of the service (used for DLQ topic naming)
49
+ * @param kafkaConfig - Kafka client configuration
50
+ * @param logger - Optional NestJS Logger instance
51
+ */
52
+ constructor(serviceName: string, kafkaConfig: KafkaClientConfig, logger?: Logger);
53
+ /**
54
+ * Initialize DLQ producer and connect to Kafka
55
+ *
56
+ * Creates a Kafka producer instance with the provided configuration
57
+ * and establishes connection to the Kafka cluster.
58
+ *
59
+ * @throws Error if connection fails or kafkajs is not installed
60
+ */
61
+ connect(): Promise<void>;
62
+ /**
63
+ * Disconnect DLQ producer and cleanup resources
64
+ *
65
+ * Gracefully disconnects the producer and releases resources.
66
+ */
67
+ disconnect(): Promise<void>;
68
+ /**
69
+ * Send message to dead letter queue
70
+ *
71
+ * Creates a DLQ message with complete error context and sends it to the
72
+ * service-specific DLQ topic. Preserves message ordering within partitions.
73
+ *
74
+ * @param originalMessage - The original message payload that failed processing
75
+ * @param error - The error that caused the failure
76
+ * @param context - Context information (topic, partition, offset, retry count)
77
+ * @throws Error if producer is not connected or send fails
78
+ */
79
+ sendToDLQ(originalMessage: any, error: Error, context: DLQContext): Promise<void>;
80
+ /**
81
+ * Get DLQ topic name for service
82
+ *
83
+ * Returns the DLQ topic name following the naming convention:
84
+ * {service-name}-dlq
85
+ *
86
+ * @returns DLQ topic name
87
+ */
88
+ getDLQTopicName(): string;
89
+ /**
90
+ * Check if DLQ handler is connected
91
+ *
92
+ * @returns True if connected, false otherwise
93
+ */
94
+ isConnectedToBroker(): boolean;
95
+ /**
96
+ * Get service name
97
+ *
98
+ * @returns Service name used by this handler
99
+ */
100
+ getServiceName(): string;
101
+ }
102
+ //# sourceMappingURL=dlq-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dlq-handler.d.ts","sourceRoot":"","sources":["../../src/kafka/dlq-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAc,MAAM,SAAS,CAAC;AAqDxD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,UAAU,CAAmC;IAErD;;;;;;OAMG;gBAED,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,iBAAiB,EAC9B,MAAM,CAAC,EAAE,MAAM;IA4BjB;;;;;;;OAOG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgD9B;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBjC;;;;;;;;;;OAUG;IACG,SAAS,CACb,eAAe,EAAE,GAAG,EACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC;IA4DhB;;;;;;;OAOG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;OAIG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;;;OAIG;IACH,cAAc,IAAI,MAAM;CAGzB"}
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ /**
3
+ * Dead Letter Queue Handler
4
+ *
5
+ * Handles messages that fail processing after all retry attempts.
6
+ * Sends failed messages to a service-specific DLQ topic with complete error context.
7
+ *
8
+ * Features:
9
+ * - Service-specific DLQ topics ({service-name}-dlq)
10
+ * - Preserves original message payload and metadata
11
+ * - Includes error details and retry count
12
+ * - Maintains message ordering within partitions
13
+ * - Structured logging for all DLQ operations
14
+ *
15
+ * Note: This implementation requires kafkajs to be installed in the consuming service.
16
+ * Install with: npm install kafkajs
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.DeadLetterQueueHandler = void 0;
20
+ const common_1 = require("@nestjs/common");
21
+ const kafka_logger_1 = require("./kafka-logger");
22
+ /**
23
+ * DeadLetterQueueHandler class manages failed message handling
24
+ *
25
+ * Provides methods to send failed messages to DLQ topics with complete
26
+ * error context and metadata preservation.
27
+ *
28
+ * Requires kafkajs to be installed in the consuming service.
29
+ */
30
+ class DeadLetterQueueHandler {
31
+ /**
32
+ * Create a new DeadLetterQueueHandler instance
33
+ *
34
+ * @param serviceName - Name of the service (used for DLQ topic naming)
35
+ * @param kafkaConfig - Kafka client configuration
36
+ * @param logger - Optional NestJS Logger instance
37
+ */
38
+ constructor(serviceName, kafkaConfig, logger) {
39
+ this.producer = null;
40
+ this.kafka = null;
41
+ this.isConnected = false;
42
+ this.KafkaClass = null;
43
+ if (!serviceName || serviceName.trim() === '') {
44
+ throw new Error('serviceName is required and cannot be empty');
45
+ }
46
+ if (!kafkaConfig) {
47
+ throw new Error('kafkaConfig is required');
48
+ }
49
+ this.serviceName = serviceName.trim();
50
+ this.kafkaConfig = kafkaConfig;
51
+ this.logger = logger || new common_1.Logger('DeadLetterQueueHandler');
52
+ this.kafkaLogger = new kafka_logger_1.KafkaLogger(serviceName, this.logger);
53
+ // Dynamically load kafkajs if available
54
+ try {
55
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
56
+ const kafkajs = require('kafkajs');
57
+ this.KafkaClass = kafkajs.Kafka;
58
+ }
59
+ catch (error) {
60
+ this.logger.warn('kafkajs not found. DLQ handler will not be functional. ' +
61
+ 'Install kafkajs with: npm install kafkajs');
62
+ }
63
+ }
64
+ /**
65
+ * Initialize DLQ producer and connect to Kafka
66
+ *
67
+ * Creates a Kafka producer instance with the provided configuration
68
+ * and establishes connection to the Kafka cluster.
69
+ *
70
+ * @throws Error if connection fails or kafkajs is not installed
71
+ */
72
+ async connect() {
73
+ if (this.isConnected && this.producer) {
74
+ this.logger.warn('DLQ handler already connected');
75
+ return;
76
+ }
77
+ if (!this.KafkaClass) {
78
+ throw new Error('kafkajs is not installed. Install it with: npm install kafkajs');
79
+ }
80
+ try {
81
+ this.logger.log(`Connecting DLQ handler for service: ${this.serviceName}`);
82
+ // Create Kafka instance
83
+ this.kafka = new this.KafkaClass({
84
+ clientId: `${this.kafkaConfig.clientId}-dlq`,
85
+ brokers: this.kafkaConfig.brokers,
86
+ ssl: this.kafkaConfig.ssl,
87
+ sasl: this.kafkaConfig.sasl,
88
+ connectionTimeout: this.kafkaConfig.connectionTimeout,
89
+ requestTimeout: this.kafkaConfig.requestTimeout,
90
+ retry: this.kafkaConfig.retry
91
+ });
92
+ // Create producer
93
+ this.producer = this.kafka.producer({
94
+ allowAutoTopicCreation: true,
95
+ transactionTimeout: 30000,
96
+ retry: this.kafkaConfig.retry
97
+ });
98
+ // Connect producer
99
+ await this.producer.connect();
100
+ this.isConnected = true;
101
+ this.logger.log(`DLQ handler connected successfully for service: ${this.serviceName}`);
102
+ }
103
+ catch (error) {
104
+ const errorMessage = error instanceof Error ? error.message : String(error);
105
+ this.logger.error(`Failed to connect DLQ handler: ${errorMessage}`, error instanceof Error ? error.stack : undefined);
106
+ throw new Error(`DLQ handler connection failed: ${errorMessage}`);
107
+ }
108
+ }
109
+ /**
110
+ * Disconnect DLQ producer and cleanup resources
111
+ *
112
+ * Gracefully disconnects the producer and releases resources.
113
+ */
114
+ async disconnect() {
115
+ if (!this.isConnected || !this.producer) {
116
+ this.logger.warn('DLQ handler not connected, skipping disconnect');
117
+ return;
118
+ }
119
+ try {
120
+ this.logger.log(`Disconnecting DLQ handler for service: ${this.serviceName}`);
121
+ await this.producer.disconnect();
122
+ this.producer = null;
123
+ this.kafka = null;
124
+ this.isConnected = false;
125
+ this.logger.log(`DLQ handler disconnected successfully`);
126
+ }
127
+ catch (error) {
128
+ const errorMessage = error instanceof Error ? error.message : String(error);
129
+ this.logger.error(`Error disconnecting DLQ handler: ${errorMessage}`, error instanceof Error ? error.stack : undefined);
130
+ throw new Error(`DLQ handler disconnect failed: ${errorMessage}`);
131
+ }
132
+ }
133
+ /**
134
+ * Send message to dead letter queue
135
+ *
136
+ * Creates a DLQ message with complete error context and sends it to the
137
+ * service-specific DLQ topic. Preserves message ordering within partitions.
138
+ *
139
+ * @param originalMessage - The original message payload that failed processing
140
+ * @param error - The error that caused the failure
141
+ * @param context - Context information (topic, partition, offset, retry count)
142
+ * @throws Error if producer is not connected or send fails
143
+ */
144
+ async sendToDLQ(originalMessage, error, context) {
145
+ if (!this.isConnected || !this.producer) {
146
+ throw new Error('DLQ handler is not connected. Call connect() before sending messages.');
147
+ }
148
+ try {
149
+ // Build DLQ message with complete context
150
+ const dlqMessage = {
151
+ originalTopic: context.topic,
152
+ originalPartition: context.partition,
153
+ originalOffset: context.offset,
154
+ payload: originalMessage,
155
+ error: {
156
+ message: error.message,
157
+ stack: error.stack,
158
+ code: error.code || 'UNKNOWN_ERROR'
159
+ },
160
+ retryCount: context.retryCount,
161
+ timestamp: new Date(),
162
+ serviceName: this.serviceName
163
+ };
164
+ // Get DLQ topic name
165
+ const dlqTopic = this.getDLQTopicName();
166
+ // Prepare producer record
167
+ const producerRecord = {
168
+ topic: dlqTopic,
169
+ messages: [
170
+ {
171
+ key: `${context.topic}-${context.partition}-${context.offset}`,
172
+ value: JSON.stringify(dlqMessage),
173
+ partition: context.partition, // Preserve partition for ordering
174
+ timestamp: dlqMessage.timestamp.getTime().toString()
175
+ }
176
+ ]
177
+ };
178
+ // Send to DLQ
179
+ await this.producer.send(producerRecord);
180
+ // Log DLQ event
181
+ this.kafkaLogger.logDLQEvent(dlqMessage);
182
+ this.logger.log(`Message sent to DLQ: ${dlqTopic} ` +
183
+ `(original: ${context.topic}, partition: ${context.partition}, offset: ${context.offset})`);
184
+ }
185
+ catch (error) {
186
+ const errorMessage = error instanceof Error ? error.message : String(error);
187
+ this.logger.error(`Failed to send message to DLQ: ${errorMessage}`, error instanceof Error ? error.stack : undefined);
188
+ throw new Error(`DLQ send failed: ${errorMessage}`);
189
+ }
190
+ }
191
+ /**
192
+ * Get DLQ topic name for service
193
+ *
194
+ * Returns the DLQ topic name following the naming convention:
195
+ * {service-name}-dlq
196
+ *
197
+ * @returns DLQ topic name
198
+ */
199
+ getDLQTopicName() {
200
+ return `${this.serviceName}-dlq`;
201
+ }
202
+ /**
203
+ * Check if DLQ handler is connected
204
+ *
205
+ * @returns True if connected, false otherwise
206
+ */
207
+ isConnectedToBroker() {
208
+ return this.isConnected;
209
+ }
210
+ /**
211
+ * Get service name
212
+ *
213
+ * @returns Service name used by this handler
214
+ */
215
+ getServiceName() {
216
+ return this.serviceName;
217
+ }
218
+ }
219
+ exports.DeadLetterQueueHandler = DeadLetterQueueHandler;
220
+ //# sourceMappingURL=dlq-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dlq-handler.js","sourceRoot":"","sources":["../../src/kafka/dlq-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,2CAAwC;AAExC,iDAA6C;AA8D7C;;;;;;;GAOG;AACH,MAAa,sBAAsB;IAUjC;;;;;;OAMG;IACH,YACE,WAAmB,EACnB,WAA8B,EAC9B,MAAe;QAjBT,aAAQ,GAA2B,IAAI,CAAC;QAGxC,UAAK,GAAyB,IAAI,CAAC;QACnC,gBAAW,GAAY,KAAK,CAAC;QAC7B,eAAU,GAA8B,IAAI,CAAC;QAcnD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;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ACF,MAAM,IAAI,KAAK,CAAC,oBAAoB,YAAY,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,eAAe;QACb,OAAO,GAAG,IAAI,CAAC,WAAW,MAAM,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AA5OD,wDA4OC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Kafka Health Check Provider
3
+ *
4
+ * Provides health check functionality for Kafka connections.
5
+ * Verifies connection status and broker availability with timeout protection.
6
+ *
7
+ * Used by NestJS health check endpoints to monitor Kafka connectivity.
8
+ */
9
+ import { Logger } from '@nestjs/common';
10
+ import { ClientKafka } from '@nestjs/microservices';
11
+ import { KafkaHealthStatus } from './types';
12
+ /**
13
+ * Health check provider options
14
+ */
15
+ export interface KafkaHealthCheckOptions {
16
+ timeout?: number;
17
+ logger?: Logger;
18
+ }
19
+ /**
20
+ * KafkaHealthCheckProvider class for monitoring Kafka connection health
21
+ */
22
+ export declare class KafkaHealthCheckProvider {
23
+ private client;
24
+ private logger;
25
+ private checkTimeout;
26
+ private connectedAt?;
27
+ constructor(client: ClientKafka, options?: KafkaHealthCheckOptions);
28
+ /**
29
+ * Check if Kafka connection is healthy
30
+ *
31
+ * Performs a quick health check by attempting to fetch broker metadata.
32
+ * Returns true if connection is healthy, false otherwise.
33
+ *
34
+ * @returns Promise<boolean> - true if healthy, false if unhealthy
35
+ */
36
+ isHealthy(): Promise<boolean>;
37
+ /**
38
+ * Get detailed health status
39
+ *
40
+ * Fetches comprehensive health information including:
41
+ * - Connection status (up/down)
42
+ * - Broker list and count
43
+ * - Connection timestamp
44
+ * - Error details if unhealthy
45
+ * - Last check timestamp
46
+ *
47
+ * @returns Promise<KafkaHealthStatus> - Detailed health status object
48
+ */
49
+ getHealthStatus(): Promise<KafkaHealthStatus>;
50
+ /**
51
+ * Fetch broker metadata with timeout protection
52
+ *
53
+ * Attempts to fetch broker metadata from the Kafka client.
54
+ * Implements timeout to prevent blocking health check endpoints.
55
+ *
56
+ * @returns Promise<any> - Broker metadata object
57
+ * @throws Error if timeout is exceeded or metadata fetch fails
58
+ * @private
59
+ */
60
+ private fetchBrokerMetadata;
61
+ /**
62
+ * Set the connected timestamp
63
+ *
64
+ * Allows external code to set the connection timestamp when the client
65
+ * successfully connects. This is useful for tracking connection uptime.
66
+ *
67
+ * @param timestamp - Connection timestamp
68
+ */
69
+ setConnectedAt(timestamp: Date): void;
70
+ /**
71
+ * Reset the connected timestamp
72
+ *
73
+ * Clears the connection timestamp, typically called when the client
74
+ * disconnects or connection is lost.
75
+ */
76
+ resetConnectedAt(): void;
77
+ }
78
+ //# sourceMappingURL=health-check.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-check.provider.d.ts","sourceRoot":"","sources":["../../src/kafka/health-check.provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAOD;;GAEG;AACH,qBAAa,wBAAwB;IAMjC,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAO;gBAGjB,MAAM,EAAE,WAAW,EAC3B,OAAO,CAAC,EAAE,uBAAuB;IAMnC;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAUnC;;;;;;;;;;;OAWG;IACG,eAAe,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAuDnD;;;;;;;;;OASG;YACW,mBAAmB;IA4CjC;;;;;;;OAOG;IACH,cAAc,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI;IAIrC;;;;;OAKG;IACH,gBAAgB,IAAI,IAAI;CAGzB"}
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ /**
3
+ * Kafka Health Check Provider
4
+ *
5
+ * Provides health check functionality for Kafka connections.
6
+ * Verifies connection status and broker availability with timeout protection.
7
+ *
8
+ * Used by NestJS health check endpoints to monitor Kafka connectivity.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.KafkaHealthCheckProvider = void 0;
12
+ const common_1 = require("@nestjs/common");
13
+ /**
14
+ * Default health check timeout (5 seconds)
15
+ */
16
+ const DEFAULT_HEALTH_CHECK_TIMEOUT = 5000;
17
+ /**
18
+ * KafkaHealthCheckProvider class for monitoring Kafka connection health
19
+ */
20
+ class KafkaHealthCheckProvider {
21
+ constructor(client, options) {
22
+ this.client = client;
23
+ this.logger = options?.logger || new common_1.Logger('KafkaHealthCheckProvider');
24
+ this.checkTimeout = options?.timeout || DEFAULT_HEALTH_CHECK_TIMEOUT;
25
+ }
26
+ /**
27
+ * Check if Kafka connection is healthy
28
+ *
29
+ * Performs a quick health check by attempting to fetch broker metadata.
30
+ * Returns true if connection is healthy, false otherwise.
31
+ *
32
+ * @returns Promise<boolean> - true if healthy, false if unhealthy
33
+ */
34
+ async isHealthy() {
35
+ try {
36
+ const status = await this.getHealthStatus();
37
+ return status.status === 'up';
38
+ }
39
+ catch (error) {
40
+ this.logger.error('Health check failed with exception', error);
41
+ return false;
42
+ }
43
+ }
44
+ /**
45
+ * Get detailed health status
46
+ *
47
+ * Fetches comprehensive health information including:
48
+ * - Connection status (up/down)
49
+ * - Broker list and count
50
+ * - Connection timestamp
51
+ * - Error details if unhealthy
52
+ * - Last check timestamp
53
+ *
54
+ * @returns Promise<KafkaHealthStatus> - Detailed health status object
55
+ */
56
+ async getHealthStatus() {
57
+ const lastChecked = new Date();
58
+ try {
59
+ // Attempt to fetch broker metadata with timeout
60
+ const metadata = await this.fetchBrokerMetadata();
61
+ // If we successfully fetched metadata, connection is healthy
62
+ if (metadata && metadata.brokers && metadata.brokers.length > 0) {
63
+ // Set connectedAt timestamp if not already set
64
+ if (!this.connectedAt) {
65
+ this.connectedAt = new Date();
66
+ }
67
+ const brokers = metadata.brokers.map((broker) => `${broker.host}:${broker.port}`);
68
+ this.logger.log(`Kafka health check passed: ${brokers.length} broker(s) available`);
69
+ return {
70
+ status: 'up',
71
+ brokers,
72
+ brokerCount: brokers.length,
73
+ connectedAt: this.connectedAt,
74
+ lastChecked
75
+ };
76
+ }
77
+ // No brokers found
78
+ this.logger.warn('Kafka health check failed: No brokers available');
79
+ this.connectedAt = undefined;
80
+ return {
81
+ status: 'down',
82
+ error: 'No brokers available',
83
+ lastChecked
84
+ };
85
+ }
86
+ catch (error) {
87
+ // Health check failed
88
+ const errorMessage = error instanceof Error ? error.message : String(error);
89
+ this.logger.error(`Kafka health check failed: ${errorMessage}`);
90
+ this.connectedAt = undefined;
91
+ return {
92
+ status: 'down',
93
+ error: errorMessage,
94
+ lastChecked
95
+ };
96
+ }
97
+ }
98
+ /**
99
+ * Fetch broker metadata with timeout protection
100
+ *
101
+ * Attempts to fetch broker metadata from the Kafka client.
102
+ * Implements timeout to prevent blocking health check endpoints.
103
+ *
104
+ * @returns Promise<any> - Broker metadata object
105
+ * @throws Error if timeout is exceeded or metadata fetch fails
106
+ * @private
107
+ */
108
+ async fetchBrokerMetadata() {
109
+ return new Promise((resolve, reject) => {
110
+ // Set timeout to prevent hanging
111
+ const timeoutId = setTimeout(() => {
112
+ reject(new Error(`Health check timeout after ${this.checkTimeout}ms`));
113
+ }, this.checkTimeout);
114
+ try {
115
+ // Access the underlying Kafka client
116
+ // ClientKafka wraps the KafkaJS client, we need to access it
117
+ const kafkaClient = this.client.client;
118
+ if (!kafkaClient) {
119
+ clearTimeout(timeoutId);
120
+ reject(new Error('Kafka client not initialized'));
121
+ return;
122
+ }
123
+ // Fetch broker metadata using KafkaJS admin client
124
+ const admin = kafkaClient.admin();
125
+ admin.connect()
126
+ .then(() => admin.fetchTopicMetadata())
127
+ .then((metadata) => {
128
+ clearTimeout(timeoutId);
129
+ admin.disconnect().catch(() => {
130
+ // Ignore disconnect errors
131
+ });
132
+ resolve(metadata);
133
+ })
134
+ .catch((error) => {
135
+ clearTimeout(timeoutId);
136
+ admin.disconnect().catch(() => {
137
+ // Ignore disconnect errors
138
+ });
139
+ reject(error);
140
+ });
141
+ }
142
+ catch (error) {
143
+ clearTimeout(timeoutId);
144
+ reject(error);
145
+ }
146
+ });
147
+ }
148
+ /**
149
+ * Set the connected timestamp
150
+ *
151
+ * Allows external code to set the connection timestamp when the client
152
+ * successfully connects. This is useful for tracking connection uptime.
153
+ *
154
+ * @param timestamp - Connection timestamp
155
+ */
156
+ setConnectedAt(timestamp) {
157
+ this.connectedAt = timestamp;
158
+ }
159
+ /**
160
+ * Reset the connected timestamp
161
+ *
162
+ * Clears the connection timestamp, typically called when the client
163
+ * disconnects or connection is lost.
164
+ */
165
+ resetConnectedAt() {
166
+ this.connectedAt = undefined;
167
+ }
168
+ }
169
+ exports.KafkaHealthCheckProvider = KafkaHealthCheckProvider;
170
+ //# sourceMappingURL=health-check.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-check.provider.js","sourceRoot":"","sources":["../../src/kafka/health-check.provider.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,2CAAwC;AAYxC;;GAEG;AACH,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAE1C;;GAEG;AACH,MAAa,wBAAwB;IAKnC,YACU,MAAmB,EAC3B,OAAiC;QADzB,WAAM,GAAN,MAAM,CAAa;QAG3B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,IAAI,eAA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AAC,CAAC;oBAClD,OAAO;gBACT,CAAC;gBAED,mDAAmD;gBACnD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC;gBAElC,KAAK,CAAC,OAAO,EAAE;qBACZ,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;qBACtC,IAAI,CAAC,CAAC,QAAa,EAAE,EAAE;oBACtB,YAAY,CAAC,SAAS,CAAC,CAAC;oBACxB,KAAK,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;wBAC5B,2BAA2B;oBAC7B,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACpB,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;oBACtB,YAAY,CAAC,SAAS,CAAC,CAAC;oBACxB,KAAK,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;wBAC5B,2BAA2B;oBAC7B,CAAC,CAAC,CAAC;oBACH,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,YAAY,CAAC,SAAS,CAAC,CAAC;gBACxB,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,cAAc,CAAC,SAAe;QAC5B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACH,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;CACF;AA7KD,4DA6KC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Kafka Utilities Index
3
+ *
4
+ * Central export point for all Kafka configuration utilities, types, and classes
5
+ * used across the Tiryaq microservices platform.
6
+ */
7
+ export * from './types';
8
+ export { KafkaConfigManager } from './kafka-config.manager';
9
+ export { BrokerParser } from './broker-parser';
10
+ export { KafkaLogger } from './kafka-logger';
11
+ export { KafkaSubscriptionRegistry } from './subscription-registry';
12
+ export { KafkaHealthCheckProvider, KafkaHealthCheckOptions } from './health-check.provider';
13
+ export { CircuitBreakerProvider } from './circuit-breaker.provider';
14
+ export { DeadLetterQueueHandler, DLQContext } from './dlq-handler';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kafka/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Kafka Utilities Index
4
+ *
5
+ * Central export point for all Kafka configuration utilities, types, and classes
6
+ * used across the Tiryaq microservices platform.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.DeadLetterQueueHandler = exports.CircuitBreakerProvider = exports.KafkaHealthCheckProvider = exports.KafkaSubscriptionRegistry = exports.KafkaLogger = exports.BrokerParser = exports.KafkaConfigManager = void 0;
24
+ // Export all types and interfaces
25
+ __exportStar(require("./types"), exports);
26
+ // Export classes (will be implemented in subsequent tasks)
27
+ var kafka_config_manager_1 = require("./kafka-config.manager");
28
+ Object.defineProperty(exports, "KafkaConfigManager", { enumerable: true, get: function () { return kafka_config_manager_1.KafkaConfigManager; } });
29
+ var broker_parser_1 = require("./broker-parser");
30
+ Object.defineProperty(exports, "BrokerParser", { enumerable: true, get: function () { return broker_parser_1.BrokerParser; } });
31
+ var kafka_logger_1 = require("./kafka-logger");
32
+ Object.defineProperty(exports, "KafkaLogger", { enumerable: true, get: function () { return kafka_logger_1.KafkaLogger; } });
33
+ var subscription_registry_1 = require("./subscription-registry");
34
+ Object.defineProperty(exports, "KafkaSubscriptionRegistry", { enumerable: true, get: function () { return subscription_registry_1.KafkaSubscriptionRegistry; } });
35
+ var health_check_provider_1 = require("./health-check.provider");
36
+ Object.defineProperty(exports, "KafkaHealthCheckProvider", { enumerable: true, get: function () { return health_check_provider_1.KafkaHealthCheckProvider; } });
37
+ var circuit_breaker_provider_1 = require("./circuit-breaker.provider");
38
+ Object.defineProperty(exports, "CircuitBreakerProvider", { enumerable: true, get: function () { return circuit_breaker_provider_1.CircuitBreakerProvider; } });
39
+ var dlq_handler_1 = require("./dlq-handler");
40
+ Object.defineProperty(exports, "DeadLetterQueueHandler", { enumerable: true, get: function () { return dlq_handler_1.DeadLetterQueueHandler; } });
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kafka/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,kCAAkC;AAClC,0CAAwB;AAExB,2DAA2D;AAC3D,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,iEAAoE;AAA3D,kIAAA,yBAAyB,OAAA;AAClC,iEAA4F;AAAnF,iIAAA,wBAAwB,OAAA;AACjC,uEAAoE;AAA3D,kIAAA,sBAAsB,OAAA;AAC/B,6CAAmE;AAA1D,qHAAA,sBAAsB,OAAA"}