Skip to main content

ConsumerGroupMetadata

Trait ConsumerGroupMetadata 

Source
pub trait ConsumerGroupMetadata:
    Send
    + Sync
    + Debug
    + 'static {
    // Required methods
    fn group_id(&self) -> &str;
    fn generation_id(&self) -> i32;
    fn member_id(&self) -> &str;
    fn group_instance_id(&self) -> Option<&str>;
}
Expand description

The consumer group information: group id, generation id, member id and group instance id.

Corresponds to Java’s org.apache.kafka.clients.consumer.ConsumerGroupMetadata.

Java has deprecated both public constructors since 4.2 (@Deprecated(since = "4.2", forRemoval = true)): “please use KafkaConsumer#groupMetadata() instead. This class will be an interface in Kafka 5.0.” The Rust client translates the class directly in its 5.0 shape, a trait, so the deprecated constructors are never public. The only way to obtain a value is Consumer::group_metadata, which returns the implementation owned by the consumer. The trait is dyn-compatible, so send_offsets_to_transaction accepts the metadata of any consumer implementation, including a future classic-protocol one.

Display on dyn ConsumerGroupMetadata renders Java’s toString().

Required Methods§

Source

fn group_id(&self) -> &str

The consumer group ID.

Source

fn generation_id(&self) -> i32

The current generation ID, or -1 (UNKNOWN_GENERATION_ID) if unknown.

Source

fn member_id(&self) -> &str

The member ID, or an empty string (UNKNOWN_MEMBER_ID) if unknown.

Source

fn group_instance_id(&self) -> Option<&str>

The group instance ID, if the consumer is a static member.

Trait Implementations§

Source§

impl Display for dyn ConsumerGroupMetadata

Source§

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

Matches Java’s String.format("GroupMetadata(groupId = %s, generationId = %d, memberId = %s, groupInstanceId = %s)", …) where groupInstanceId is replaced with an empty string if absent.

Implementors§