I am using Kafka.js in a Nest.js project. This is how I initialise KafkaClient:
@Module({
...
providers: [{
provide: 'KAFKA_CLIENT',
useFactory: async (configService: KafkaClientConfigService) => {
const kafkaOptions = configService.getKafkaOptions();
return ClientProxyFactory.create(kafkaOptions);
},
inject: [KafkaClientConfigService],
},
]
...
})
Now I inject KafkaClient to my Controller, and I wish to consume messages with intervals.
While there is a way to do it with Kafka.js using consumer.pause()
I could not find any reference to such option in KafkaClient.
Is there any option to do so either by pausing or by throttling the consumer?