initproducerid.go 1.1 KB

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