github.com/hack0072008/kafka-go@v1.0.1/protocol/heartbeat/heartbeat.go (about)

     1  package heartbeat
     2  
     3  import "github.com/hack0072008/kafka-go/protocol"
     4  
     5  func init() {
     6  	protocol.Register(&Request{}, &Response{})
     7  }
     8  
     9  // Detailed API definition: https://kafka.apache.org/protocol#The_Messages_Heartbeat
    10  type Request struct {
    11  	// We need at least one tagged field to indicate that this is a "flexible" message
    12  	// type.
    13  	_ struct{} `kafka:"min=v4,max=v4,tag"`
    14  
    15  	GroupID         string `kafka:"min=v0,max=v4"`
    16  	GenerationID    int32  `kafka:"min=v0,max=v4"`
    17  	MemberID        string `kafka:"min=v0,max=v4"`
    18  	GroupInstanceID string `kafka:"min=v3,max=v4,nullable"`
    19  }
    20  
    21  func (r *Request) ApiKey() protocol.ApiKey {
    22  	return protocol.Heartbeat
    23  }
    24  
    25  type Response struct {
    26  	// We need at least one tagged field to indicate that this is a "flexible" message
    27  	// type.
    28  	_ struct{} `kafka:"min=v4,max=v4,tag"`
    29  
    30  	ErrorCode      int16 `kafka:"min=v0,max=v4"`
    31  	ThrottleTimeMs int32 `kafka:"min=v1,max=v4"`
    32  }
    33  
    34  func (r *Response) ApiKey() protocol.ApiKey {
    35  	return protocol.Heartbeat
    36  }