Takahiro Suzuki | d7bf820 | 2020-12-17 20:21:59 +0900 | [diff] [blame] | 1 | package sarama |
| 2 | |
| 3 | type HeartbeatRequest struct { |
| 4 | GroupId string |
| 5 | GenerationId int32 |
| 6 | MemberId string |
| 7 | } |
| 8 | |
| 9 | func (r *HeartbeatRequest) encode(pe packetEncoder) error { |
| 10 | if err := pe.putString(r.GroupId); err != nil { |
| 11 | return err |
| 12 | } |
| 13 | |
| 14 | pe.putInt32(r.GenerationId) |
| 15 | |
| 16 | if err := pe.putString(r.MemberId); err != nil { |
| 17 | return err |
| 18 | } |
| 19 | |
| 20 | return nil |
| 21 | } |
| 22 | |
| 23 | func (r *HeartbeatRequest) decode(pd packetDecoder, version int16) (err error) { |
| 24 | if r.GroupId, err = pd.getString(); err != nil { |
| 25 | return |
| 26 | } |
| 27 | if r.GenerationId, err = pd.getInt32(); err != nil { |
| 28 | return |
| 29 | } |
| 30 | if r.MemberId, err = pd.getString(); err != nil { |
| 31 | return |
| 32 | } |
| 33 | |
| 34 | return nil |
| 35 | } |
| 36 | |
| 37 | func (r *HeartbeatRequest) key() int16 { |
| 38 | return 12 |
| 39 | } |
| 40 | |
| 41 | func (r *HeartbeatRequest) version() int16 { |
| 42 | return 0 |
| 43 | } |
| 44 | |
| 45 | func (r *HeartbeatRequest) requiredVersion() KafkaVersion { |
| 46 | return V0_9_0_0 |
| 47 | } |