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ยงasync fn seek(&mut self, ts: Timestamp) -> RedisResult<()>
async fn seek(&mut self, ts: Timestamp) -> RedisResult<()>
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ยงasync fn rewind(&mut self, pos: SeqPos) -> RedisResult<()>
async fn rewind(&mut self, pos: SeqPos) -> RedisResult<()>
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 Freeze for RedisConsumer
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