What is Heartbeat?
Classic-protocol consumers send this on a fixed interval to prove liveness to the group coordinator. Missing a heartbeat within session.timeout.ms kicks the member and triggers a rebalance, usually because consumers spend too long in poll() processing, starving the heartbeat thread.
| Version | Kafka | Changes |
|---|---|---|
| HeartbeatRequest | ||
| v0 | 2.2 | + GroupId string+ GenerationId int32+ MemberId string |
| v1 | 2.2 | and version 2 are the same as version 0. Starting from version 3, we add a new field called groupInstanceId to indicate member identity across restarts. |
| v2 | 2.2 | No changes |
| v3 | 2.3 | + GroupInstanceId string |
| v4 | 2.4 | ~ Flexible encoding enabled FLEXIBLE is the first flexible version. |
| HeartbeatResponse | ||
| v0 | 2.2 | + ErrorCode int16 |
| v1 | 2.2 | + ThrottleTimeMs int32adds throttle time. |
| v2 | 2.2 | on quota violation, brokers send out responses before throttling. Starting from version 3, heartbeatRequest supports a new field called groupInstanceId to indicate member identity across restarts. |
| v3 | 2.3 | No changes |
| v4 | 2.4 | ~ Flexible encoding enabled FLEXIBLE is the first flexible version. |