sync_group_response.go 862 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package sarama
  2. type SyncGroupResponse struct {
  3. Err KError
  4. MemberAssignment []byte
  5. }
  6. func (r *SyncGroupResponse) GetMemberAssignment() (*ConsumerGroupMemberAssignment, error) {
  7. assignment := new(ConsumerGroupMemberAssignment)
  8. err := decode(r.MemberAssignment, assignment)
  9. return assignment, err
  10. }
  11. func (r *SyncGroupResponse) encode(pe packetEncoder) error {
  12. pe.putInt16(int16(r.Err))
  13. return pe.putBytes(r.MemberAssignment)
  14. }
  15. func (r *SyncGroupResponse) decode(pd packetDecoder, version int16) (err error) {
  16. kerr, err := pd.getInt16()
  17. if err != nil {
  18. return err
  19. }
  20. r.Err = KError(kerr)
  21. r.MemberAssignment, err = pd.getBytes()
  22. return
  23. }
  24. func (r *SyncGroupResponse) key() int16 {
  25. return 14
  26. }
  27. func (r *SyncGroupResponse) version() int16 {
  28. return 0
  29. }
  30. func (r *SyncGroupResponse) requiredVersion() KafkaVersion {
  31. return V0_9_0_0
  32. }