pub struct Manager { /* private fields */ }Expand description
Task Queue manager.
Implementations§
Source§impl Manager
impl Manager
Sourcepub async fn new(
queue: Queue,
config: ManagerConfig,
) -> Result<Self, ConfigError>
pub async fn new( queue: Queue, config: ManagerConfig, ) -> Result<Self, ConfigError>
Creates new manager from configuration.
Sourcepub fn config(&self) -> &ManagerConfig
pub fn config(&self) -> &ManagerConfig
Access manager’s configuration
Sourcepub fn max_pending_retry_count(&self) -> u64
pub fn max_pending_retry_count(&self) -> u64
Returns number of re-tries current configuration should allow.
Generally it is just min(self.config.max_pending_time / self.config.poll_time, 1)
Sourcepub fn pending_tasks(
&self,
count: usize,
last_id: Option<StreamId>,
) -> PendingIter<'_>
pub fn pending_tasks( &self, count: usize, last_id: Option<StreamId>, ) -> PendingIter<'_>
Creates iterator of pending entries in queue.
last_id can be used to specify from where to continue for iteration purpose.
Sourcepub fn expired_pending_tasks(
&self,
count: usize,
last_id: Option<StreamId>,
) -> PendingIter<'_>
pub fn expired_pending_tasks( &self, count: usize, last_id: Option<StreamId>, ) -> PendingIter<'_>
Creates iterator of expired entries in queue
last_id can be used to specify from where to continue for iteration purpose.
Sourcepub fn fetch_new_tasks(&self, count: usize) -> FetchIter<'_>
pub fn fetch_new_tasks(&self, count: usize) -> FetchIter<'_>
Creates iterator over new tasks within queue
Sourcepub async fn get_pending_by_id<T: FromRedisValue>(
&self,
id: StreamId,
) -> Result<Option<Entry<T>>, RedisError>
pub async fn get_pending_by_id<T: FromRedisValue>( &self, id: StreamId, ) -> Result<Option<Entry<T>>, RedisError>
Retrieves task entry by id
§Implementation
Due to Redis not providing any method to get message by id, we have to emulate it by doing
query for message after id - 1 to fetch message by id.
If message is no longer exist, we return None.
Note that when reading pending message data, there is no timeout possible
If there is no message, it will return None
Sourcepub async fn consume_tasks(
&self,
tasks: &[StreamId],
) -> Result<usize, RedisError>
pub async fn consume_tasks( &self, tasks: &[StreamId], ) -> Result<usize, RedisError>
Consumes tasks by specified IDs.
If error is returned, tasks modified with cleaned IDs removed.