KafkaJS Discard connection to consumer

currently I am stuck trying to disconnect my consumer properly.

My frontend lets me send a request to backend, which then starts a Consumer, to consume all messages of that topic , and then return them.

The first request works just fine, but when I send the 2nd, another consumer joins the group (cause i start a node for every request), and Kafka rebalances the >100 000 messages topic and this takes a few seconds.

So this led me to the issue, that my consumer does not get disconnected properly.

I checked in my code, that consumer.disconnect() get executed and it does. However if I check with this command:

kafka-consumer-groups –bootstrap-server localhost:9092 –describe –group test-group

I can see it is still connected, so how do I manage to discard this connection. If I wait for ~20 sec and I check again with this command. He is being disconnected (must be kafka connection timeout).

If I sent a request now, I get the result almost instantly which means he started a new connection, instead of joining a group and having to rebalance. How do I solve this ? XD