Skip to main content

ConsumerGroupManager

Struct ConsumerGroupManager 

Source
pub struct ConsumerGroupManager { /* private fields */ }
Expand description

Owns all consumer groups for a single CDC ring.

Provides the full group lifecycle: creation, per-consumer reads, acknowledgement, pending-entry inspection, ownership transfer (claim), and gap detection.

Implementations§

Source§

impl ConsumerGroupManager

Source

pub fn new(default_idle_timeout: Duration) -> Self

Create a manager whose newly created groups use default_idle_timeout for pending-entry redelivery.

Source

pub fn create_group( &mut self, name: &str, start_seq: u64, ) -> Result<(), ConsumerGroupError>

Create a consumer group that begins delivering events at start_seq.

Returns ConsumerGroupError::GroupExists if name is already taken.

Source

pub fn read_group( &mut self, ring: &CdcRing, group_name: &str, consumer_name: &str, count: usize, ) -> Result<GroupReadResult, ConsumerGroupError>

Deliver up to count events to consumer_name within group_name.

Before reading fresh events from the ring, timed-out pending entries owned by other consumers are reclaimed and delivered first. The consumer is auto-created if it does not already exist.

Source

pub fn ack( &mut self, group_name: &str, seqs: &[u64], ) -> Result<usize, ConsumerGroupError>

Acknowledge one or more events by sequence number.

Acknowledged entries are removed from every consumer’s pending list within the group. Returns the total number of entries removed.

Source

pub fn pending( &self, group_name: &str, ) -> Result<Vec<PendingSummary>, ConsumerGroupError>

Return a snapshot of every pending entry across all consumers in the group, sorted by sequence number.

Source

pub fn claim( &mut self, group_name: &str, target_consumer: &str, min_idle: Duration, seqs: &[u64], ) -> Result<Vec<u64>, ConsumerGroupError>

Transfer ownership of pending entries to target_consumer.

Only entries whose idle time meets or exceeds min_idle are transferred. Returns the sequence numbers that were claimed.

Source

pub fn has_group(&self, name: &str) -> bool

Return true if a group with the given name exists.

Source

pub fn group_count(&self) -> usize

Return the number of registered groups.

Source

pub fn check_gap( &mut self, ring: &CdcRing, group_name: &str, consumer_name: &str, ) -> Result<bool, ConsumerGroupError>

Check whether consumer_name in group_name has fallen behind the ring.

Returns true if the consumer’s last acknowledged sequence has been evicted from the ring, or if the consumer was already marked for resync.

Trait Implementations§

Source§

impl Default for ConsumerGroupManager

Source§

fn default() -> Self

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

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> 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, 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.