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. }