...
Note that the necessary logic to establish a connection to the Kafka broker node acting as the group coordinator is outside the scope of the CGMSM logic.
The following diagram provides a visual overview of the states and transitions for members of the consumer group:
In order to keep the size of a ConsumerGroupHeartbeatRequest
smaller, KIP-848's description of the request schema states that some values are conditionally sent with the request only when they change on the client. These values include:
InstanceId
RackId
RebalanceTimeoutMs
SubscribedTopicNames
SubscribedTopicRegex
ServerAssignor
ClientAssignors
TopicPartitions
The following diagram provides a visual overview of the states and transitions for members of the consumer group:
Gliffy Diagram | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Gliffy Diagram | ||||||||
|
...
NEW
is the initial state for a CGSM CGMSM upon its creation. The Consumer
will remain in this state until the next pass of the background thread loop.
...
Since this is the first request to the coordinator, the ConsumerGroupHeartbeatRequest
will be a full request, including values for the following:
...
CGMSM will include a ConsumerGroupHeartbeatRequest
with all conditional values present. This includes setting TopicPartitions
to null
since there are no assigned partitions
...
in this state.
Once the initial ConsumerGroupHeartbeatResponse
is received successfully, the CGMSM will update its local MemberId
and MemberEpoch
based on the returned data. It will then transition to the JOINED
state.
JOINED
When the CGMSM has joined the group, we enter into its namesake state. However, this state simply indicates that the Consumer
instance is known to the coordinator as a member of the group. It does not necessarily imply that it has been assigned any partitions. While in the JOINED
state the CGMSM will periodically send requests to the coordinator at the needed cadence in order to maintain membership.
Per KIP-848's description of the request schema, the above values are only sent with the ConsumerGroupHeartbeatRequest
when they change on the client.
JOINED
afsdfsa
ASSIGNING
TBD
TERMINATING
TBD
...