corebasic 1.0.4 → 1.0.5
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/libs/kafka.js +30 -30
- package/package.json +1 -1
package/libs/kafka.js
CHANGED
|
@@ -6,7 +6,7 @@ let appName
|
|
|
6
6
|
let topicPrefix = ''
|
|
7
7
|
|
|
8
8
|
function start(arg) {
|
|
9
|
-
arg = !arg && !process.env.APP_DEPLOYMENT_NAME ? { clientId: (global.app?.name ?? 'app') + '-dev', brokers: ['127.0.0.1:9092'], sasl: false, logLevel:
|
|
9
|
+
arg = !arg && !process.env.APP_DEPLOYMENT_NAME ? { clientId: (global.app?.name ?? 'app') + '-dev', brokers: ['127.0.0.1:9092'], sasl: false, logLevel: logLevel.ERROR } : arg
|
|
10
10
|
appName = arg?.clientId ?? (process.env.APP_DEPLOYMENT_NAME ?? (global.app?.name ?? 'app'))
|
|
11
11
|
topicPrefix = `${appName}.`
|
|
12
12
|
kafka = new Kafka({
|
|
@@ -122,33 +122,33 @@ module.exports = {
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
const errorTypes = ['unhandledRejection', 'uncaughtException']
|
|
126
|
-
const signalTraps = ['SIGTERM', 'SIGINT', 'SIGUSR2']
|
|
125
|
+
// const errorTypes = ['unhandledRejection', 'uncaughtException']
|
|
126
|
+
// const signalTraps = ['SIGTERM', 'SIGINT', 'SIGUSR2']
|
|
127
|
+
//
|
|
128
|
+
// errorTypes.forEach(type => {
|
|
129
|
+
// process.on(type, async () => {
|
|
130
|
+
// try {
|
|
131
|
+
// console.log(`process.on ${type}`)
|
|
132
|
+
// if (producer)
|
|
133
|
+
// await producer.disconnect()
|
|
134
|
+
// for (let i = 0; i < consumers.length; i++)
|
|
135
|
+
// await consumers[i].disconnect()
|
|
136
|
+
// process.exit(0)
|
|
137
|
+
// } catch (_) {
|
|
138
|
+
// process.exit(1)
|
|
139
|
+
// }
|
|
140
|
+
// })
|
|
141
|
+
// })
|
|
127
142
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
})
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
signalTraps.forEach(type => {
|
|
144
|
-
process.once(type, async () => {
|
|
145
|
-
try {
|
|
146
|
-
if (producer)
|
|
147
|
-
await producer.disconnect()
|
|
148
|
-
for (let i = 0; i < consumers.length; i++)
|
|
149
|
-
await consumers[i].disconnect()
|
|
150
|
-
} finally {
|
|
151
|
-
process.kill(process.pid, type)
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
})
|
|
143
|
+
// signalTraps.forEach(type => {
|
|
144
|
+
// process.once(type, async () => {
|
|
145
|
+
// try {
|
|
146
|
+
// if (producer)
|
|
147
|
+
// await producer.disconnect()
|
|
148
|
+
// for (let i = 0; i < consumers.length; i++)
|
|
149
|
+
// await consumers[i].disconnect()
|
|
150
|
+
// } finally {
|
|
151
|
+
// process.kill(process.pid, type)
|
|
152
|
+
// }
|
|
153
|
+
// })
|
|
154
|
+
// })
|