GroupMetadata

Struct GroupMetadata 

Source
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:

  1. which consumer is subscribed to what topic
  2. which consumer is assigned of which partition

The metadata are divided into 2 classes:

  1. 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
  2. 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

Source§

fn clone(&self) -> GroupMetadata

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GroupMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GroupMetadata

Source§

fn default() -> GroupMetadata

Returns the “default value” for a type. Read more
Source§

impl PartialEq for GroupMetadata

Source§

fn eq(&self, other: &GroupMetadata) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for GroupMetadata

Source§

impl StructuralPartialEq for GroupMetadata

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.