Changed kafka method signature.

This commit is contained in:
Mike Cao 2024-07-05 02:29:12 -07:00
parent 26462cffbc
commit 72b3b6158a
4 changed files with 6 additions and 6 deletions

View File

@ -61,8 +61,8 @@ function getDateFormat(date: Date, format?: string): string {
}
async function sendMessage(
message: { [key: string]: string | number },
topic: string,
message: { [key: string]: string | number },
): Promise<RecordMetadata[]> {
await connect();
@ -77,7 +77,7 @@ async function sendMessage(
});
}
async function sendMessages(messages: { [key: string]: string | number }[], topic: string) {
async function sendMessages(topic: string, messages: { [key: string]: string | number }[]) {
await connect();
await producer.send({

View File

@ -82,7 +82,7 @@ async function clickhouseQuery(data: {
});
if (kafka.enabled) {
await sendMessages(messages, 'event_data');
await sendMessages('event_data', messages);
} else {
await insert('event_data', messages);
}

View File

@ -167,7 +167,7 @@ async function clickhouseQuery(data: {
};
if (kafka.enabled) {
await sendMessage(message, 'event');
await sendMessage('event', message);
} else {
await insert('website_event', [message]);
}

View File

@ -101,9 +101,9 @@ async function clickhouseQuery(data: {
});
if (kafka.enabled) {
await sendMessages(messages, 'session_data');
await sendMessages('session_data', messages);
} else {
await insert('event_data', messages);
await insert('session_data', messages);
}
return data;