pub struct ChannelReceiver { /* private fields */ }Expand description
Receiver for channel events.
Implementations§
Source§impl ChannelReceiver
impl ChannelReceiver
Sourcepub fn current_offset(&self) -> u64
pub fn current_offset(&self) -> u64
Get the next offset that will be assigned (i.e., total messages received so far).
Sourcepub async fn recv(&mut self) -> Result<Event, ChannelError>
pub async fn recv(&mut self) -> Result<Event, ChannelError>
Receive the next event.
When AckMode::Auto, messages are automatically acknowledged on receive.
When AckMode::Manual, messages are tracked as unacknowledged and must be
explicitly acknowledged via [ack]. When AckMode::None, no tracking is performed.
Sourcepub fn try_recv(&mut self) -> Result<Option<Event>, ChannelError>
pub fn try_recv(&mut self) -> Result<Option<Event>, ChannelError>
Try to receive an event without blocking.
Sourcepub fn ack(&self, offset: u64) -> Result<(), ChannelError>
pub fn ack(&self, offset: u64) -> Result<(), ChannelError>
Acknowledge a message by its offset.
Only meaningful when AckMode::Manual. Removes the message from the
unacknowledged set. Returns an error if the offset is not found.
Sourcepub fn unacked_count(&self) -> usize
pub fn unacked_count(&self) -> usize
Get the number of unacknowledged messages.
Sourcepub fn acked_count(&self) -> usize
pub fn acked_count(&self) -> usize
Get the number of acknowledged messages.
Sourcepub fn get_unacked_messages(&self) -> Vec<(u64, Event)>
pub fn get_unacked_messages(&self) -> Vec<(u64, Event)>
Get all unacknowledged messages for re-delivery.
Returns a vector of (offset, event) pairs for messages that have been received but not yet acknowledged.