pub struct ConsumerRegistry { /* private fields */ }Expand description
Registry that manages durable consumers with persistent cursor positions.
Consumer state is stored as system events in the WAL pipeline so it survives Core restarts. In-memory state is held in a DashMap for O(1) access.
Two modes:
- In-memory (
new()): no persistence, for tests and backward compatibility - Durable (
new_durable()): backed bySystemMetadataStore, survives restarts
Implementations§
Source§impl ConsumerRegistry
impl ConsumerRegistry
Sourcepub fn new_durable(system_store: Arc<SystemMetadataStore>) -> Self
pub fn new_durable(system_store: Arc<SystemMetadataStore>) -> Self
Create a durable consumer registry backed by SystemMetadataStore.
On construction, replays all _system.consumer.* events to rebuild
the in-memory cache from WAL.
Sourcepub fn register(
&self,
consumer_id: &str,
event_type_filters: &[String],
) -> Consumer
pub fn register( &self, consumer_id: &str, event_type_filters: &[String], ) -> Consumer
Register a consumer (or update its filters if it already exists).
Sourcepub fn get(&self, consumer_id: &str) -> Option<Consumer>
pub fn get(&self, consumer_id: &str) -> Option<Consumer>
Get a consumer by ID. Returns None if not registered.
Sourcepub fn get_or_create(&self, consumer_id: &str) -> Consumer
pub fn get_or_create(&self, consumer_id: &str) -> Consumer
Get or implicitly create a consumer.
Sourcepub fn ack(
&self,
consumer_id: &str,
position: u64,
max_offset: u64,
) -> Result<(), String>
pub fn ack( &self, consumer_id: &str, position: u64, max_offset: u64, ) -> Result<(), String>
Acknowledge events up to a given global offset. Returns Ok(()) on success, Err if the position is beyond the max offset.
Sourcepub fn matches_filters(event_type: &str, filters: &[String]) -> bool
pub fn matches_filters(event_type: &str, filters: &[String]) -> bool
Check if an event type matches a consumer’s filters. Empty filters = match all.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConsumerRegistry
impl !RefUnwindSafe for ConsumerRegistry
impl Send for ConsumerRegistry
impl Sync for ConsumerRegistry
impl Unpin for ConsumerRegistry
impl UnsafeUnpin for ConsumerRegistry
impl !UnwindSafe for ConsumerRegistry
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