Skip to content

Commit 20e71be

Browse files
committed
switch kafka-lz4-lite
1 parent 255c496 commit 20e71be

File tree

3 files changed

+153
-251
lines changed

3 files changed

+153
-251
lines changed

packages/service-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"sideEffects": false,
4747
"dependencies": {
4848
"aws4fetch": "1.0.20",
49+
"kafka-lz4-lite": "^1.0.5",
4950
"kafkajs": "2.2.4",
50-
"kafkajs-lz4": "2.0.0-beta.0",
5151
"zod": "3.24.1"
5252
},
5353
"devDependencies": {

packages/service-utils/src/node/usageV2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { randomUUID } from "node:crypto";
22
import { checkServerIdentity } from "node:tls";
3+
import { codec as lz4Codec } from "kafka-lz4-lite";
34
import {
45
CompressionTypes,
56
Kafka,
67
type Producer,
78
type ProducerConfig,
89
} from "kafkajs";
9-
import LZ4Codec from "kafkajs-lz4";
1010
import type { ServiceName } from "../core/services.js";
1111
import { type UsageV2Event, getTopicName } from "../core/usageV2.js";
1212

@@ -91,7 +91,7 @@ export class UsageV2Producer {
9191
*/
9292
async init(configOverrides?: ProducerConfig) {
9393
if (this.compression === CompressionTypes.LZ4) {
94-
CompressionCodecs[CompressionTypes.LZ4] = new LZ4Codec().codec;
94+
CompressionCodecs[CompressionTypes.LZ4] = lz4Codec;
9595
}
9696

9797
this.producer = this.kafka.producer({

0 commit comments

Comments
 (0)