@lucaapp/service-utils 1.2.0 → 1.2.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.
|
@@ -114,12 +114,17 @@ class KafkaClient {
|
|
|
114
114
|
this.logger.debug(`Topic=${topic} already exists. Not creating.`);
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
const numPartitions = this.environment == serviceIdentity_1.Environment.LOCAL ? 1 : 3;
|
|
118
|
+
const replicationFactor = this.environment == serviceIdentity_1.Environment.LOCAL ? 1 : 3;
|
|
119
|
+
await this.admin.createTopics({
|
|
120
|
+
topics: [
|
|
121
|
+
{
|
|
122
|
+
topic,
|
|
123
|
+
numPartitions,
|
|
124
|
+
replicationFactor,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
});
|
|
123
128
|
this.logger.debug(`Topic=${topic} created.`);
|
|
124
129
|
};
|
|
125
130
|
this.consume = async (groupId, kafkaTopic, handler, fromBeginning = false) => {
|
|
@@ -134,6 +139,7 @@ class KafkaClient {
|
|
|
134
139
|
const decryptedValue = await this.decryptValue(kafkaTopic, message.value);
|
|
135
140
|
await this.verifySignature(kafkaTopic, decryptedValue, message.headers);
|
|
136
141
|
const value = this.parseValue(decryptedValue);
|
|
142
|
+
this.logger.debug({ key: message.key, value, timestamp: message.timestamp }, 'Record received');
|
|
137
143
|
await handler({ ...message, value });
|
|
138
144
|
},
|
|
139
145
|
});
|