pub struct GroupMetadata {
pub message_version: i16,
pub group: String,
pub is_tombstone: bool,
pub schema_version: i16,
pub protocol_type: String,
pub generation: i32,
pub protocol: String,
pub leader: String,
pub current_state_timestamp: i64,
pub members: Vec<MemberMetadata>,
}Expand description
Contains the current state of a consumer group.
It is used by the Group Coordinator Broker to track:
- which consumer is subscribed to what topic
- which consumer is assigned of which partition
The metadata are divided into 2 classes:
- Membership metadata
- Members registered in this group
- Current protocol assigned to the group (e.g. partition assignment strategy for consumers)
- Protocol metadata associated with group members
- State metadata
- Consumer group state
- Generation ID
- Leader ID
Compared to OffsetCommit, GroupMetadata appears relatively infrequently in
__consumer_offsets: this is because it’s usually produced when consumers join or leave
groups.
Kafka uses code generation to materialise GroupMetadata into Java code,
and this is composed of 2 json definitions, that at compile time get turned into Java Classes:
GroupMetadataKey and GroupMetadataValue.
Note: As this data is parsed from a message, each field is marked with (KEY) or (PAYLOAD), depending to what part of the message they were parsed from.
Fields§
§message_version: i16(KEY) First 2-bytes integers in the original __consumer_offsets, identifying this data type.
This controls the bespoke binary parser behaviour.
group: String(KEY) Group that this struct describes.
is_tombstone: bool(PAYLOAD) Is this from a tombstone message?
If this is true, this struct doesn’t represent group, but the removal
of this specific key (i.e. group) from __consumer_offsets.
If you are tracking this data, this can be used as a “can be removed” signal: likely all consumers of this particular group are gone, and something explicitly removed their group membership information.
The removal follows the Log Compaction rules of Kafka.
schema_version: i16(PAYLOAD) Informs the parser of what data and in which format, the rest of the payload contains.
This controls the bespoke binary parser behaviour.
protocol_type: String(PAYLOAD) The class (type) of GroupMetadata::protocol used by this group.
Possible values are consumer or connect.
If value is consumer, it indicates that GroupMetadata::protocol will describes the
type of ConsumerPartitionAssignor used by the Group Coordinator.
If the value is connect, it indicates that GroupMetadata::protocol will describes the
type of ConnectAssignor used by the WorkerCoordinator.
generation: i32(PAYLOAD) Monotonically increasing integers, changes when group members change.
This is useful when concurrent operations get out of order, and original order has to be determined.
protocol: String(PAYLOAD) The protocol of GroupMetadata::protocol_type used by this group.
If protocol_type == consumer, this field will contain the identifier of an implementation
of ConsumerPartitionAssignor.
If protocol_type == connect, this field will contain the identifier of an implementation
of ConnectAssignor.
leader: String(PAYLOAD) Identifier (ID) of the GroupMetadata::members leader.
This corresponds to the MemberMetadata::id of one of the Self::members.
current_state_timestamp: i64(PAYLOAD) Timestamp of when this Group State was captured.
This timestamp is produced to __consumer_offsets by the Group Coordinator:
to interpret it correctly, its important to know its timezone.
NOTE: The type of this field is controlled by the ts_* feature flags.
members: Vec<MemberMetadata>(PAYLOAD) Members that are part of this GroupMetadata::group.
Trait Implementations§
Source§impl Clone for GroupMetadata
impl Clone for GroupMetadata
Source§fn clone(&self) -> GroupMetadata
fn clone(&self) -> GroupMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more