conduktor.io ↗

Kafka BrokerHeartbeat Request Wire Format v1 — Binary Protocol Layout

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.

Related Errors

BROKER_ID_NOT_REGISTERED

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 v1
BrokerId int32 · 4B
BrokerEpoch int64 · 8B
CurrentMetadataOffset int64 · 8B
WantFence bool · 1B
WantShutDown bool · 1B
OfflineLogDirs []uuid
tagged var

Schema & Example

Schema
{
  "BrokerId": int32,
  "BrokerEpoch": int64,
  "CurrentMetadataOffset": int64,
  "WantFence": bool,
  "WantShutDown": bool,
  "OfflineLogDirs": [uuid]
}
Example
{
  "BrokerId": 1,
  "BrokerEpoch": 12,
  "CurrentMetadataOffset": 150382,
  "WantFence": true,
  "WantShutDown": true,
  "OfflineLogDirs": ["550e8400-e29b-41d4-...", "6ba7b810-9dad-11d1-..."]
}