pub struct FetchIter<'a> { /* private fields */ }
Expand description
Iterator to fetch messages from within queue.
If fetch parameters are to query new messages, it will only return freshly added messages. Once these messages are fetched, they are considered pending and no longer returned by this iterator
If fetch parameter specifies to return pending messages within queue, then iterator will resume after last message id.
Implementations§
Source§impl<'a> FetchIter<'a>
impl<'a> FetchIter<'a>
Sourcepub fn new(params: FetchParams<'a>, queue: Queue) -> Self
pub fn new(params: FetchParams<'a>, queue: Queue) -> Self
Creates new iterator
Sourcepub fn set_cursor(&mut self, typ: FetchType)
pub fn set_cursor(&mut self, typ: FetchType)
Sets cursor to position where to iterate from.
Sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Sets time waiting to fetch data.
Redis will return reply within this time, not necessary immediately even if data is available.
Sourcepub async fn next<T: FromRedisValue>(
&mut self,
) -> Result<FetchResult<T>, RedisError>
pub async fn next<T: FromRedisValue>( &mut self, ) -> Result<FetchResult<T>, RedisError>
Performs fetch, returning messages depending on FetchParams::typ
.
If pending messages are fetched, moves cursor to last pending message after fetched messages.
We fetch our task as raw bytes to ensure we can always get it, regardless how it was serialized.
Sourcepub async fn next_entries<T: FromRedisValue>(
&mut self,
) -> Result<Vec<Entry<T>>, RedisError>
pub async fn next_entries<T: FromRedisValue>( &mut self, ) -> Result<Vec<Entry<T>>, RedisError>
Performs fetch, returning messages depending on FetchParams::typ
.
If pending messages are fetched, moves cursor to last pending message after fetched messages.
We fetch our task as raw bytes to ensure we can always get it, regardless how it was serialized.
Differently from next
it returns only list of entries