github.com/hoveychen/kafka-go@v0.4.42/protocol/initproducerid/initproducerid.go (about) 1 package initproducerid 2 3 import "github.com/hoveychen/kafka-go/protocol" 4 5 func init() { 6 protocol.Register(&Request{}, &Response{}) 7 } 8 9 type Request struct { 10 // We need at least one tagged field to indicate that this is a "flexible" message 11 // type. 12 _ struct{} `kafka:"min=v2,max=v4,tag"` 13 14 TransactionalID string `kafka:"min=v0,max=v4,nullable"` 15 TransactionTimeoutMs int32 `kafka:"min=v0,max=v4"` 16 ProducerID int64 `kafka:"min=v3,max=v4"` 17 ProducerEpoch int16 `kafka:"min=v3,max=v4"` 18 } 19 20 func (r *Request) ApiKey() protocol.ApiKey { return protocol.InitProducerId } 21 22 func (r *Request) Transaction() string { return r.TransactionalID } 23 24 var _ protocol.TransactionalMessage = (*Request)(nil) 25 26 type Response struct { 27 // We need at least one tagged field to indicate that this is a "flexible" message 28 // type. 29 _ struct{} `kafka:"min=v2,max=v4,tag"` 30 31 ThrottleTimeMs int32 `kafka:"min=v0,max=v4"` 32 ErrorCode int16 `kafka:"min=v0,max=v4"` 33 ProducerID int64 `kafka:"min=v0,max=v4"` 34 ProducerEpoch int16 `kafka:"min=v0,max=v4"` 35 } 36 37 func (r *Response) ApiKey() protocol.ApiKey { return protocol.InitProducerId }