Given a Kafka Consumer with a static membership, what would be the best practice to gracefully shut it down?
From Kafka - the definitive guide: By calling .close()
Always close() the consumer before exiting. This will close the network connections and sockets. It will also trigger a rebalance immediately rather than wait for the group coordinator to discover that the consumer stopped sending heartbeats and is likely dead, which will take longer and therefore result in a longer period of time in which consumers can’t consume messages from a subset of the partitions.
So if a static membership is used, close() is not what we really want. Maybe a tweaked version if it to close the network sockets but not causing a rebalance?
Another thing to note is that the unsubscribe is not causing a rebalance.
I am really wondering how others imagine the shutdown mechanism in this special case.