Struct sea_streamer_redis::RedisConsumer
source · pub struct RedisConsumer { /* private fields */ }
Expand description
The Redis Consumer.
Implementations§
source§impl RedisConsumer
impl RedisConsumer
sourcepub fn group_id(&self) -> Option<&ConsumerGroup>
pub fn group_id(&self) -> Option<&ConsumerGroup>
Get the assigned group id.
sourcepub fn consumer_id(&self) -> Option<&ConsumerId>
pub fn consumer_id(&self) -> Option<&ConsumerId>
Get the assigned consumer id.
sourcepub fn stream_shards(&self) -> &[(StreamKey, ShardId)]
pub fn stream_shards(&self) -> &[(StreamKey, ShardId)]
Return the stream-shards this consumer has been assigned. On create, it will self-assign all shards.
sourcepub async fn seek_to(&mut self, id: MessageId) -> RedisResult<()>
pub async fn seek_to(&mut self, id: MessageId) -> RedisResult<()>
Like Consumer::seek
, but with MessageId
.
sourcepub fn ack(&self, msg: &SharedMessage) -> RedisResult<()>
pub fn ack(&self, msg: &SharedMessage) -> RedisResult<()>
Mark a message as read. The ACK will be queued for commit.
pub fn ack_with( &self, (stream_key, shard_id, sequence): &(StreamKey, ShardId, SeqNo) ) -> RedisResult<()>
sourcepub fn commit(&mut self) -> RedisResult<impl Future<Output = RedisResult<()>>>
pub fn commit(&mut self) -> RedisResult<impl Future<Output = RedisResult<()>>>
Commit all pending acks and (optionally) wait for the result.
sourcepub fn commit_asap(&mut self) -> RedisResult<()>
pub fn commit_asap(&mut self) -> RedisResult<()>
Push a Commit request to the command queue, will be executed on the next cycle
sourcepub async fn end(self) -> RedisResult<()>
pub async fn end(self) -> RedisResult<()>
Commit all pending acks and end the consumer.
Trait Implementations§
source§impl Consumer for RedisConsumer
impl Consumer for RedisConsumer
type Error = RedisErr
type Message<'a> = SharedMessage
type NextFuture<'a> = NextFuture<'a>
type Stream<'a> = StreamFuture<'a>
source§fn seek<'life0, 'async_trait>(
&'life0 mut self,
ts: Timestamp
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn seek<'life0, 'async_trait>( &'life0 mut self, ts: Timestamp ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Seek all streams to an arbitrary point in time. It will start consuming from the earliest message
with a timestamp later than
to
. Read moresource§fn rewind<'life0, 'async_trait>(
&'life0 mut self,
pos: SeqPos
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rewind<'life0, 'async_trait>( &'life0 mut self, pos: SeqPos ) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Rewind all streams to a particular sequence number. Read more
source§fn assign(&mut self, (stream, shard): (StreamKey, ShardId)) -> RedisResult<()>
fn assign(&mut self, (stream, shard): (StreamKey, ShardId)) -> RedisResult<()>
Assign this consumer to a particular shard. Can be called multiple times to assign
to multiple shards. Returns error
StreamKeyNotFound
if the stream is not currently subscribed. Read moresource§fn unassign(&mut self, s: (StreamKey, ShardId)) -> RedisResult<()>
fn unassign(&mut self, s: (StreamKey, ShardId)) -> RedisResult<()>
Unassign a shard. Returns error
StreamKeyNotFound
if the stream is not currently subscribed.
Returns error StreamKeyEmpty
if all streams have been unassigned.source§fn next(&self) -> NextFuture<'_> ⓘ
fn next(&self) -> NextFuture<'_> ⓘ
Poll and receive one message: it awaits until there are new messages.
This method can be called from multiple threads.
Auto Trait Implementations§
impl RefUnwindSafe for RedisConsumer
impl Send for RedisConsumer
impl Sync for RedisConsumer
impl Unpin for RedisConsumer
impl UnwindSafe for RedisConsumer
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