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
Request Header · flexible
message_size
int32 · 4B
api_key
int16 · 2B
api_version
int16 · 2B
correlation_id
int32 · 4B
client_id
string (compact)
tagged
var
BrokerHeartbeatRequest v0
BrokerId
int32 · 4B
BrokerEpoch
int64 · 8B
CurrentMetadataOffset
int64 · 8B
WantFence
bool · 1B
WantShutDown
bool · 1B
tagged
var
Schema & Example
Schema { "BrokerId": int32, "BrokerEpoch": int64, "CurrentMetadataOffset": int64, "WantFence": bool, "WantShutDown": bool }
Example { "BrokerId": 1, "BrokerEpoch": 12, "CurrentMetadataOffset": 150382, "WantFence": true, "WantShutDown": true }