consumer_metadata_request.go 868 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package sarama
  2. //ConsumerMetadataRequest is used for metadata requests
  3. type ConsumerMetadataRequest struct {
  4. ConsumerGroup string
  5. }
  6. func (r *ConsumerMetadataRequest) encode(pe packetEncoder) error {
  7. tmp := new(FindCoordinatorRequest)
  8. tmp.CoordinatorKey = r.ConsumerGroup
  9. tmp.CoordinatorType = CoordinatorGroup
  10. return tmp.encode(pe)
  11. }
  12. func (r *ConsumerMetadataRequest) decode(pd packetDecoder, version int16) (err error) {
  13. tmp := new(FindCoordinatorRequest)
  14. if err := tmp.decode(pd, version); err != nil {
  15. return err
  16. }
  17. r.ConsumerGroup = tmp.CoordinatorKey
  18. return nil
  19. }
  20. func (r *ConsumerMetadataRequest) key() int16 {
  21. return 10
  22. }
  23. func (r *ConsumerMetadataRequest) version() int16 {
  24. return 0
  25. }
  26. func (r *ConsumerMetadataRequest) headerVersion() int16 {
  27. return 1
  28. }
  29. func (r *ConsumerMetadataRequest) requiredVersion() KafkaVersion {
  30. return V0_8_2_0
  31. }