I am looking at NestJs Kafka integration/KafkaJs and have a few questions around how it's working.
The way I have defined the consumer is as below:
@EventPattern(process.env.TOPIC_NAME, Transport.KAFKA)
async processEvent(event: Record<string, unknown>) {
await this.service.handleEvent(event);
}
The client has been set with default properties:
- max.partition.fetch.bytes: 1048576
- heartbeat.interval.ms: 3000
- session.timeout.ms: 10000
Questions:
- Let's say the first fetch brought 600 messages, and processing of each message is taking 1 sec. When will the next fetch job be executed? Is it always at the end of the execution of the first batch? Or it happens periodically.
Looking at the logs it seems it always happens at the end of the execution of a batch but not sure.
- Do we have something similar to
max.poll.interval.ms
in NestJS/KafkaJs? i.e If the batch is not executed in a given time then rebalancing will occur.