pub struct EventSubscription { /* private fields */ }Expand description
A handle to an individual SierraDB subscription.
Provides a typed interface for receiving subscription messages.
Implementations§
Source§impl EventSubscription
impl EventSubscription
Sourcepub fn subscription_id(&self) -> Uuid
pub fn subscription_id(&self) -> Uuid
Get the unique identifier for this subscription.
Sourcepub async fn next_message(&mut self) -> Option<SierraMessage>
pub async fn next_message(&mut self) -> Option<SierraMessage>
Receive the next message from this subscription.
Returns None if the subscription has been closed.
Sourcepub fn into_stream(self) -> impl Stream<Item = SierraMessage>
pub fn into_stream(self) -> impl Stream<Item = SierraMessage>
Convert this subscription into a stream of messages.
This consumes the subscription and returns a stream that can be used
with stream combinators like while let Some(msg) = stream.next().await.
Sourcepub async fn acknowledge_up_to_cursor(&self, cursor: u64) -> RedisResult<()>
pub async fn acknowledge_up_to_cursor(&self, cursor: u64) -> RedisResult<()>
Acknowledge events up to a specific cursor for this subscription.
The cursor value is provided with each event in the subscription stream. Acknowledging up to a cursor allows the subscription window to advance.
Sourcepub async fn unsubscribe(self) -> RedisResult<()>
pub async fn unsubscribe(self) -> RedisResult<()>
Unsubscribe and close this subscription.
After calling this, no more messages will be received.