...
- UNJOINED: There's no rebalance. For the simple consumed use case, the GroupState remains in UNJOINED
- PREPARE: Sending the heartbeat and await the response
- ASSIGN: Assignment updated, client thread side callbacks are triggered, and await completion
- COMPLETE: Client thread callback completed and has notified the background thread.
- STABLE: stable group
Consumer group member state machine
It becomes clear when reading KIP-848 that the work of keeping the consumer group in proper state is fairly involved. We therefore turn our focus now to the logic needed for the consumer group member state machine (hereafter, CGMSM).
Based on the user calling either assign()
or subscribe()
, a Consumer
determines how topic partitions are to be assigned. If the user calls the subscribe()
API, the Consumer
knows that it is being directed to use Kafka's consumer group-based partition assignment. The use of assign()
signifies the user's intention to manage the partition assignments from within the application via manual partition assignment. It is only in the former case that a CGMSM needs to be created.
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:
Gliffy Diagram | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Gliffy Diagram | ||||||||
|
The following description provides more clarity on the states that make up the CGMSM:
- NEW—the initial state for a CGSM
- JOINING—after creation, the
Consumer
will enter this state on the first pass of the background thread loop after its creation. O
Consumer API Internal Changes
...