pub struct ConsumerGroup { /* private fields */ }Expand description
Shared state for a consumer group.
Implementations§
Source§impl ConsumerGroup
impl ConsumerGroup
Sourcepub fn new(
group_name: &str,
topic_name: &str,
num_partitions: u32,
stale_threshold_secs: u64,
) -> Self
pub fn new( group_name: &str, topic_name: &str, num_partitions: u32, stale_threshold_secs: u64, ) -> Self
Create a new consumer group.
Sourcepub fn claim(&mut self, consumer_id: &str) -> Vec<u32>
pub fn claim(&mut self, consumer_id: &str) -> Vec<u32>
Claim unclaimed or stale partitions for the given consumer.
Returns the list of partition indices now assigned to this consumer.
Sourcepub fn assigned_to(&self, consumer_id: &str) -> Vec<u32>
pub fn assigned_to(&self, consumer_id: &str) -> Vec<u32>
Return the partitions currently assigned to the given consumer.
Sourcepub fn heartbeat(&mut self, consumer_id: &str)
pub fn heartbeat(&mut self, consumer_id: &str)
Update the heartbeat for a consumer’s assigned partitions.
Sourcepub fn release(&mut self, consumer_id: &str)
pub fn release(&mut self, consumer_id: &str)
Release all partitions held by the given consumer.
Sourcepub fn group_name(&self) -> &str
pub fn group_name(&self) -> &str
Returns the group name.
Sourcepub fn topic_name(&self) -> &str
pub fn topic_name(&self) -> &str
Returns the topic name.
Sourcepub fn unassigned_count(&self) -> u32
pub fn unassigned_count(&self) -> u32
Returns the number of unassigned partitions.
Auto Trait Implementations§
impl Freeze for ConsumerGroup
impl RefUnwindSafe for ConsumerGroup
impl Send for ConsumerGroup
impl Sync for ConsumerGroup
impl Unpin for ConsumerGroup
impl UnwindSafe for ConsumerGroup
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more