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.
Implementations§
Source§impl ConsumerRegistry
impl ConsumerRegistry
pub fn new() -> Self
Sourcepub fn register(
&self,
consumer_id: String,
event_type_filters: Vec<String>,
) -> Consumer
pub fn register( &self, consumer_id: String, event_type_filters: Vec<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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more