Make slightly more flexible about configs and data
This commit is contained in:
parent
5aa87c0775
commit
61b5da846a
3
app.js
3
app.js
|
@ -68,7 +68,9 @@ const getClusterData = () =>
|
||||||
Object.fromEntries(
|
Object.fromEntries(
|
||||||
Object.entries(clusters).map(([key, value]) => {
|
Object.entries(clusters).map(([key, value]) => {
|
||||||
value = JSON.parse(JSON.stringify(value))
|
value = JSON.parse(JSON.stringify(value))
|
||||||
|
if (value.config.sasl?.password) {
|
||||||
value.config.sasl.password = passwordPlaceholder
|
value.config.sasl.password = passwordPlaceholder
|
||||||
|
}
|
||||||
return [key, value.config]
|
return [key, value.config]
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -158,6 +160,7 @@ const consumers = new Map()
|
||||||
buildEscape(consumers, clusters)
|
buildEscape(consumers, clusters)
|
||||||
|
|
||||||
wsServer.on('connection', socket => {
|
wsServer.on('connection', socket => {
|
||||||
|
socket.send('CONNECTED')
|
||||||
socket.on('close', async () => {
|
socket.on('close', async () => {
|
||||||
await killConsumer(consumers.get(socket))
|
await killConsumer(consumers.get(socket))
|
||||||
consumers.delete(socket)
|
consumers.delete(socket)
|
||||||
|
|
8
query.js
8
query.js
|
@ -17,8 +17,12 @@ const realTimeMessageSearch = async ({ kafka, topic, onMessage, searchCode, immu
|
||||||
autoCommit: false,
|
autoCommit: false,
|
||||||
eachMessage: async ({ topic, partition, message }) => {
|
eachMessage: async ({ topic, partition, message }) => {
|
||||||
const s = message.value.toString()
|
const s = message.value.toString()
|
||||||
const value = JSON.parse(s)
|
let value
|
||||||
delete value.Data
|
try {
|
||||||
|
value = JSON.parse(s)
|
||||||
|
} catch (e) {
|
||||||
|
value = '' + s
|
||||||
|
}
|
||||||
message.value = value
|
message.value = value
|
||||||
const workingMessage = immutable ? deepCopy(message) : message
|
const workingMessage = immutable ? deepCopy(message) : message
|
||||||
if (!matcher || matcher(workingMessage, workingMessage.value)) {
|
if (!matcher || matcher(workingMessage, workingMessage.value)) {
|
||||||
|
|
Loading…
Reference in New Issue