I rely on kafkajs for running automated tests.
When I execute the command await consumer.disconnect()
, it usually takes approximately 5 seconds. Are there any alternative methods for ensuring a safe and quicker disconnect?
const consumer = this.client.consumer({
groupId: this.groupId,
heartbeatInterval: this.heartbeatInterval,
sessionTimeout: this.sessionTimeout,
});
await consumer.connect();
await consumer.subscribe({ topics: [topic], fromBeginning });
await consumer.run({...});
await this.disconnect(consumer);