@ccci/micro-server 1.0.151 → 1.0.152

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.js CHANGED
@@ -298986,7 +298986,6 @@ class BaseConsumer {
298986
298986
  kafka;
298987
298987
  consumer;
298988
298988
  groupId;
298989
- isRunning = false;
298990
298989
  constructor(clientId, brokers, groupId) {
298991
298990
  this.kafka = new import_kafkajs.Kafka({ clientId, brokers });
298992
298991
  this.consumer = this.kafka.consumer({ groupId });
@@ -299001,25 +299000,13 @@ class BaseConsumer {
299001
299000
  console.log(`Subscribed to topic: ${topic}`);
299002
299001
  }
299003
299002
  async run(eachMessageHandler) {
299004
- this.isRunning = true;
299005
299003
  await this.consumer.run({
299006
- eachMessage: async (payload) => {
299007
- if (!this.isRunning) {
299008
- return;
299009
- }
299010
- try {
299011
- await eachMessageHandler(payload);
299012
- } catch (error) {
299013
- console.error("Error in message handler:", error);
299014
- }
299015
- }
299004
+ eachMessage: eachMessageHandler
299016
299005
  });
299017
299006
  console.log(`Consumer is running.`);
299018
299007
  }
299019
299008
  async disconnect() {
299020
- this.isRunning = false;
299021
299009
  await this.consumer.disconnect();
299022
- await this.consumer.stop();
299023
299010
  console.log("Consumer disconnected.");
299024
299011
  }
299025
299012
  }
@@ -7,7 +7,6 @@ export declare class BaseConsumer {
7
7
  private kafka;
8
8
  private consumer;
9
9
  private groupId;
10
- private isRunning;
11
10
  /**
12
11
  * @param clientId - The client ID used to identify the consumer instance.
13
12
  * @param brokers - An array of Kafka brokers to connect to.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccci/micro-server",
3
- "version": "1.0.151",
3
+ "version": "1.0.152",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",