corebasic 1.0.9 → 1.0.11

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 (2) hide show
  1. package/libs/kafka.js +6 -2
  2. package/package.json +5 -2
package/libs/kafka.js CHANGED
@@ -46,13 +46,17 @@ const start_consumer = async function (topic, groupId, callback) {
46
46
  await consumer.subscribe({ topic: topic, fromBeginning: true })
47
47
 
48
48
  await consumer.run({
49
+ autoCommit: false,
49
50
  eachMessage: async ({ topic, partition, message }) => {
50
51
  // callback(topic, message.value.toString(), partition) // toString() returns array so won't parse if json.
52
+ let success
51
53
  try {
52
- callback(topic, JSON.parse(message.value), partition)
54
+ success = callback(topic, JSON.parse(message.value), partition)
53
55
  } catch (ex) {
54
- callback(topic, message.value, partition)
56
+ success = callback(topic, message.value, partition)
55
57
  }
58
+
59
+ await consumer.commitOffsets([{ topic, partition, offset: (Number(message.offset) + 1).toString() }]);
56
60
  },
57
61
  })
58
62
  }
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "corebasic",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "author": "",
10
- "license": "ISC"
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "jsonwebtoken": "^9.0.1"
13
+ }
11
14
  }