Im using NestJS + Kafka in the following way
const appKafka = await NestFactory.createMicroservice<KafkaOptions>(KafkaModule, {
transport: Transport.KAFKA,
options: {
client: {
brokers: [`${getEnv("KAFKA_HOST")}:${getEnv("KAFKA_PORT")}`],
},
consumer: {
groupId: "my_group_id",
heartbeatInterval: 500,
},
run: {
eachBatchAutoResolve: true,
},
},
});
await appKafka.listen();
console.log("Kafka consumer service is listening!");
It is working fine but now I need to add support for Snappy compression algorithm. How can I do that? I would like to have support for both Snappy and Gzip. I know KafkaJS only have native support for Gzip but other compression algorithms can be easily implemented as shown in the docs. What I have not figure out is how to do this involving with Nest. I would like to keep using NestFactory.createMicroservice instead of interacting with KafkaJS directly.
I have looked the KafkaOptions interface and haven't seen anything useful. Does anybody knows how to do this?