heartbeat_request.go 830 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package sarama
  2. type HeartbeatRequest struct {
  3. GroupID string
  4. GenerationID int32
  5. MemberID string
  6. }
  7. func (r *HeartbeatRequest) encode(pe packetEncoder) error {
  8. if err := pe.putString(r.GroupID); err != nil {
  9. return err
  10. }
  11. pe.putInt32(r.GenerationID)
  12. if err := pe.putString(r.MemberID); err != nil {
  13. return err
  14. }
  15. return nil
  16. }
  17. func (r *HeartbeatRequest) decode(pd packetDecoder, version int16) (err error) {
  18. if r.GroupID, err = pd.getString(); err != nil {
  19. return
  20. }
  21. if r.GenerationID, err = pd.getInt32(); err != nil {
  22. return
  23. }
  24. if r.MemberID, err = pd.getString(); err != nil {
  25. return
  26. }
  27. return nil
  28. }
  29. func (r *HeartbeatRequest) key() int16 {
  30. return 12
  31. }
  32. func (r *HeartbeatRequest) version() int16 {
  33. return 0
  34. }
  35. func (r *HeartbeatRequest) requiredVersion() KafkaVersion {
  36. return V0_9_0_0
  37. }