JoinGroup
This page encodes the smallest legal instance of the request and the response: numeric fields are zero, strings and byte arrays are empty, every array carries exactly one sample element, and any records field holds one empty 61-byte RecordBatch v2. Version 9 is a flexible version, so every struct is terminated by a uvarint tagged-field count and strings and arrays carry compact length-plus-one prefixes. Sizes below include the leading int32 size prefix.
- API key
- 11
- Encoded at
- v9
- Flexible versions
- 6+
- Headers
- req v2, resp v1
- Request versions
- 0-9
- Response versions
- 0-9
- Request size
- 33 bytes
- Response size
- 30 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields
Request
JoinGroupRequest v9, request header v2, 33 bytes on the wire
byte layout (33 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
object tree
JoinGroupRequest message v9 [0x0000, 33B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 29 [0x0000, 4B] number of bytes that follow, patched after encoding +-- RequestHeader v2 [0x0004, 11B] common request header | +-- request_api_key int16 = 11 (JoinGroup) [0x0004, 2B] numeric id of the API being invoked | +-- request_api_version int16 = 9 [0x0006, 2B] version of the API being invoked | +-- correlation_id int32 = 0 [0x0008, 4B] echoed back by the broker in the response | +-- client_id nullable_string = "" (int16 len=0) [0x000c, 2B] always a non-flexible int16-prefixed string | +-- tagged_fields uvarint = 0 [0x000e, 1B] number of tagged fields in the header +-- JoinGroupRequest struct [0x000f, 18B] message body, version 9 +-- GroupId string = "" (compact, len+1=1) [0x000f, 1B] The group identifier. +-- SessionTimeoutMs int32 = 0 [0x0010, 4B] The coordinator considers the consumer dead if it receives no heartbeat aft... +-- RebalanceTimeoutMs int32 = 0 [0x0014, 4B] The maximum time in milliseconds that the coordinator will wait for each me... +-- MemberId string = "" (compact, len+1=1) [0x0018, 1B] The member id assigned by the group coordinator. +-- GroupInstanceId string = "" (compact, len+1=1) [0x0019, 1B] The unique identifier of the consumer instance provided by end user. +-- ProtocolType string = "" (compact, len+1=1) [0x001a, 1B] The unique name the for class of protocols implemented by the group we want... +-- Protocols []JoinGroupRequestProtocol = 1 element [0x001b, 4B] The list of protocols that the member supports. | +-- length uvarint = 2 (compact, n+1) [0x001b, 1B] one sample element follows | +-- JoinGroupRequestProtocol[0] JoinGroupRequestProtocol = struct [0x001c, 3B] | +-- Name string = "" (compact, len+1=1) [0x001c, 1B] The protocol name. | +-- Metadata bytes = empty (compact, len+1=1) [0x001d, 1B] The protocol metadata. | +-- tagged_fields uvarint = 0 [0x001e, 1B] number of tagged fields in this struct +-- Reason string = "" (compact, len+1=1) [0x001f, 1B] The reason why the member (re-)joins the group. +-- tagged_fields uvarint = 0 [0x0020, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 11, "type": "request", "listeners": ["broker"], "name": "JoinGroupRequest", // Version 1 adds RebalanceTimeoutMs. Version 2 and 3 are the same as version 1. // // Starting from version 4, the client needs to issue a second request to join group // // Starting from version 5, we add a new field called groupInstanceId to indicate member identity across restarts. // with assigned id. // // Version 6 is the first flexible version. // // Version 7 is the same as version 6. // // Version 8 adds the Reason field (KIP-800). // // Version 9 is the same as version 8. "validVersions": "0-9", "flexibleVersions": "6+", "fields": [ { "name": "GroupId", "type": "string", "versions": "0+", "entityType": "groupId", "about": "The group identifier." }, { "name": "SessionTimeoutMs", "type": "int32", "versions": "0+", "about": "The coordinator considers the consumer dead if it receives no heartbeat after this timeout in milliseconds." }, // Note: if RebalanceTimeoutMs is not present, SessionTimeoutMs should be // used instead. The default of -1 here is just intended as a placeholder. { "name": "RebalanceTimeoutMs", "type": "int32", "versions": "1+", "default": "-1", "ignorable": true, "about": "The maximum time in milliseconds that the coordinator will wait for each member to rejoin when rebalancing the group." }, { "name": "MemberId", "type": "string", "versions": "0+", "about": "The member id assigned by the group coordinator." }, { "name": "GroupInstanceId", "type": "string", "versions": "5+", "nullableVersions": "5+", "default": "null", "about": "The unique identifier of the consumer instance provided by end user." }, { "name": "ProtocolType", "type": "string", "versions": "0+", "about": "The unique name the for class of protocols implemented by the group we want to join." }, { "name": "Protocols", "type": "[]JoinGroupRequestProtocol", "versions": "0+", "about": "The list of protocols that the member supports.", "fields": [ { "name": "Name", "type": "string", "versions": "0+", "mapKey": true, "about": "The protocol name." }, { "name": "Metadata", "type": "bytes", "versions": "0+", "about": "The protocol metadata." } ]}, { "name": "Reason", "type": "string", "versions": "8+", "nullableVersions": "8+", "default": "null", "ignorable": true, "about": "The reason why the member (re-)joins the group." } ] }
Response
JoinGroupResponse v9, response header v1, 30 bytes on the wire
byte layout (30 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
object tree
JoinGroupResponse message v9 [0x0000, 30B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 26 [0x0000, 4B] number of bytes that follow, patched after encoding +-- ResponseHeader v1 [0x0004, 5B] common response header | +-- correlation_id int32 = 0 [0x0004, 4B] matches the correlation_id of the request | +-- tagged_fields uvarint = 0 [0x0008, 1B] number of tagged fields in the header +-- JoinGroupResponse struct [0x0009, 21B] message body, version 9 +-- ThrottleTimeMs int32 = 0 [0x0009, 4B] The duration in milliseconds for which the request was throttled due to a q... +-- ErrorCode int16 = 0 [0x000d, 2B] The error code, or 0 if there was no error. +-- GenerationId int32 = 0 [0x000f, 4B] The generation ID of the group. +-- ProtocolType string = "" (compact, len+1=1) [0x0013, 1B] The group protocol name. +-- ProtocolName string = "" (compact, len+1=1) [0x0014, 1B] The group protocol selected by the coordinator. +-- Leader string = "" (compact, len+1=1) [0x0015, 1B] The leader of the group. +-- SkipAssignment bool = false [0x0016, 1B] True if the leader must skip running the assignment. +-- MemberId string = "" (compact, len+1=1) [0x0017, 1B] The member ID assigned by the group coordinator. +-- Members []JoinGroupResponseMember = 1 element [0x0018, 5B] The group members. | +-- length uvarint = 2 (compact, n+1) [0x0018, 1B] one sample element follows | +-- JoinGroupResponseMember[0] JoinGroupResponseMember = struct [0x0019, 4B] | +-- MemberId string = "" (compact, len+1=1) [0x0019, 1B] The group member ID. | +-- GroupInstanceId string = "" (compact, len+1=1) [0x001a, 1B] The unique identifier of the consumer instance provided by end user. | +-- Metadata bytes = empty (compact, len+1=1) [0x001b, 1B] The group member metadata. | +-- tagged_fields uvarint = 0 [0x001c, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x001d, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 11, "type": "response", "name": "JoinGroupResponse", // Version 1 is the same as version 0. // // Version 2 adds throttle time. // // Starting in version 3, on quota violation, brokers send out responses before throttling. // // Starting in version 4, the client needs to issue a second request to join group // with assigned id. // // Version 5 is bumped to apply group.instance.id to identify member across restarts. // // Version 6 is the first flexible version. // // Starting from version 7, the broker sends back the Protocol Type to the client (KIP-559). // // Version 8 is the same as version 7. // // Version 9 adds the SkipAssignment field. "validVersions": "0-9", "flexibleVersions": "6+", "fields": [ { "name": "ThrottleTimeMs", "type": "int32", "versions": "2+", "ignorable": true, "about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." }, { "name": "ErrorCode", "type": "int16", "versions": "0+", "about": "The error code, or 0 if there was no error." }, { "name": "GenerationId", "type": "int32", "versions": "0+", "default": "-1", "about": "The generation ID of the group." }, { "name": "ProtocolType", "type": "string", "versions": "7+", "nullableVersions": "7+", "default": "null", "ignorable": true, "about": "The group protocol name." }, { "name": "ProtocolName", "type": "string", "versions": "0+", "nullableVersions": "7+", "about": "The group protocol selected by the coordinator." }, { "name": "Leader", "type": "string", "versions": "0+", "about": "The leader of the group." }, { "name": "SkipAssignment", "type": "bool", "versions": "9+", "default": "false", "about": "True if the leader must skip running the assignment." }, { "name": "MemberId", "type": "string", "versions": "0+", "about": "The member ID assigned by the group coordinator." }, { "name": "Members", "type": "[]JoinGroupResponseMember", "versions": "0+", "about": "The group members.", "fields": [ { "name": "MemberId", "type": "string", "versions": "0+", "about": "The group member ID." }, { "name": "GroupInstanceId", "type": "string", "versions": "5+", "ignorable": true, "nullableVersions": "5+", "default": "null", "about": "The unique identifier of the consumer instance provided by end user." }, { "name": "Metadata", "type": "bytes", "versions": "0+", "about": "The group member metadata." }] } ] }