consumer_metadata_request.go 797 B

12345678910111213141516171819202122232425262728293031323334
  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) requiredVersion() KafkaVersion {
  27. return V0_8_2_0
  28. }