I’m using Spring Kafka for producing to a Kafka topic and consuming from it.
Everything works fine and as expected.
A consumer is considered alive as long as it sends heartbeats at regular intervals using heartbeat.interval.ms; once heartbeats are no longer sent for the period determined by session.timeout.ms the group coordinator will consider it DEAD and trigger a rebalance.
I would like to identify the case where my consumer – for some reason – has gone dead and removed from the group.
Notes:
- The process in which the dead consumer used to run is still up & running.
- I would like to identify above case so I’ll know I need to bring it back (i.e. re-subscribe to the related topic).
I’m familiar with the AdminClient with which I can describe the cluster and get a list of all consumers under a specific topic.
Is there another way or a better way to identify above situation?
For example, when I initially subscribe to a topic is there a way to register my consumer to some event listener from which I will get a notification once my consumer has been removed from the group?