What is InitProducerId?
Every idempotent or transactional producer calls this before sending records to obtain a producer ID and epoch. The epoch prevents zombie producers: a restarted instance bumps the epoch, and late-arriving writes from the old instance are rejected with INVALID_PRODUCER_EPOCH.
Wire Diagram
Response Header
message_size
int32 · 4B
correlation_id
int32 · 4B
InitProducerIdResponse v0
ThrottleTimeMs
int32 · 4B
ErrorCode
int16 · 2B
ProducerId
int64 · 8B
ProducerEpoch
int16 · 2B
Schema & Example
Schema { "ThrottleTimeMs": int32, "ErrorCode": int16, "ProducerId": int64, "ProducerEpoch": int16 }
Example { "ThrottleTimeMs": 0, "ErrorCode": 0, "ProducerId": 0, "ProducerEpoch": 12 }