RedisConsumer

Struct RedisConsumer 

Source
pub struct RedisConsumer { /* private fields */ }
Expand description

The Redis Consumer.

Implementationsยง

Sourceยง

impl RedisConsumer

Source

pub fn group_id(&self) -> Option<&ConsumerGroup>

Get the assigned group id.

Source

pub fn consumer_id(&self) -> Option<&ConsumerId>

Get the assigned consumer id.

Source

pub fn stream_shards(&self) -> &[(StreamKey, ShardId)]

Return the stream-shards this consumer has been assigned. On create, it will self-assign all shards.

Source

pub async fn seek_to(&mut self, id: MessageId) -> RedisResult<()>

Like Consumer::seek, but with MessageId.

Source

pub fn ack(&self, msg: &SharedMessage) -> RedisResult<()>

Mark a message as read. The ACK will be queued for commit.

Source

pub fn ack_with( &self, (stream_key, shard_id, sequence): &(StreamKey, ShardId, SeqNo), ) -> RedisResult<()>

Source

pub fn commit(&mut self) -> RedisResult<impl Future<Output = RedisResult<()>>>

Commit all pending acks and (optionally) wait for the result.

Source

pub fn commit_asap(&mut self) -> RedisResult<()>

Push a Commit request to the command queue, will be executed on the next cycle

Source

pub async fn end(self) -> RedisResult<()>

Commit all pending acks and end the consumer.

Trait Implementationsยง

Sourceยง

impl Consumer for RedisConsumer

Sourceยง

type Error = RedisErr

Sourceยง

type Message<'a> = SharedMessage

Sourceยง

type NextFuture<'a> = NextFuture<'a>

Sourceยง

type Stream<'a> = StreamFuture<'a>

Sourceยง

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 more
Sourceยง

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<()>

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 more
Sourceยง

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<'_> โ“˜

Poll and receive one message: it awaits until there are new messages. This method can be called from multiple threads.
Sourceยง

fn stream<'a, 'b: 'a>(&'b mut self) -> Self::Stream<'a>

Returns an async stream. You cannot create multiple streams from the same consumer, nor perform any operation while streaming.
Sourceยง

impl Debug for RedisConsumer

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<T> ErasedDestructor for T
where T: 'static,