github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/joingroup/joingroup.go (about)

     1  package joingroup
     2  
     3  import "github.com/segmentio/kafka-go/protocol"
     4  
     5  func init() {
     6  	protocol.Register(&Request{}, &Response{})
     7  }
     8  
     9  type Request struct {
    10  	// We need at least one tagged field to indicate that this is a "flexible" message
    11  	// type.
    12  	_ struct{} `kafka:"min=v6,max=v7,tag"`
    13  
    14  	GroupID            string            `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    15  	SessionTimeoutMS   int32             `kafka:"min=v0,max=v7"`
    16  	RebalanceTimeoutMS int32             `kafka:"min=v1,max=v7"`
    17  	MemberID           string            `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    18  	GroupInstanceID    string            `kafka:"min=v5,max=v5,nullable|min=v6,max=v7,compact,nullable"`
    19  	ProtocolType       string            `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    20  	Protocols          []RequestProtocol `kafka:"min=v0,max=v7"`
    21  }
    22  
    23  type RequestProtocol struct {
    24  	// We need at least one tagged field to indicate that this is a "flexible" message
    25  	// type.
    26  	_ struct{} `kafka:"min=v6,max=v7,tag"`
    27  
    28  	Name     string `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    29  	Metadata []byte `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    30  }
    31  
    32  func (r *Request) ApiKey() protocol.ApiKey {
    33  	return protocol.JoinGroup
    34  }
    35  
    36  func (r *Request) Group() string { return r.GroupID }
    37  
    38  var _ protocol.GroupMessage = (*Request)(nil)
    39  
    40  type Response struct {
    41  	// We need at least one tagged field to indicate that this is a "flexible" message
    42  	// type.
    43  	_ struct{} `kafka:"min=v6,max=v7,tag"`
    44  
    45  	ThrottleTimeMS int32            `kafka:"min=v2,max=v7"`
    46  	ErrorCode      int16            `kafka:"min=v0,max=v7"`
    47  	GenerationID   int32            `kafka:"min=v0,max=v7"`
    48  	ProtocolType   string           `kafka:"min=v7,max=v7,compact,nullable"`
    49  	ProtocolName   string           `kafka:"min=v0,max=v5|min=v6,max=v6,compact|min=v7,max=v7,compact,nullable"`
    50  	LeaderID       string           `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    51  	MemberID       string           `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    52  	Members        []ResponseMember `kafka:"min=v0,max=v7"`
    53  }
    54  
    55  type ResponseMember struct {
    56  	// We need at least one tagged field to indicate that this is a "flexible" message
    57  	// type.
    58  	_ struct{} `kafka:"min=v6,max=v7,tag"`
    59  
    60  	MemberID        string `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    61  	GroupInstanceID string `kafka:"min=v5,max=v5,nullable|min=v6,max=v7,nullable,compact"`
    62  	Metadata        []byte `kafka:"min=v0,max=v5|min=v6,max=v7,compact"`
    63  }
    64  
    65  type ResponseMemberMetadata struct{}
    66  
    67  func (r *Response) ApiKey() protocol.ApiKey { return protocol.JoinGroup }