What is BrokerHeartbeat?
Each broker sends this periodically to the KRaft controller to prove liveness and report metadata replication progress. A broker that stops heartbeating gets fenced and its leadership migrated away. The highestMetadataOffset tells the controller how caught up the broker is before unfencing after a restart.
Wire Diagram
Response Header · flexible
message_size
int32 · 4B
correlation_id
int32 · 4B
tagged
var
BrokerHeartbeatResponse v1
ThrottleTimeMs
int32 · 4B
ErrorCode
int16 · 2B
IsCaughtUp
bool · 1B
IsFenced
bool · 1B
ShouldShutDown
bool · 1B
tagged
var
Schema & Example
Schema { "ThrottleTimeMs": int32, "ErrorCode": int16, "IsCaughtUp": bool, "IsFenced": bool, "ShouldShutDown": bool }
Example { "ThrottleTimeMs": 0, "ErrorCode": 0, "IsCaughtUp": true, "IsFenced": true, "ShouldShutDown": true }