pub struct RedisBroker { /* private fields */ }Expand description
Redis-backed message broker.
Implementations§
Source§impl RedisBroker
impl RedisBroker
Sourcepub async fn new(config: RedisConfig) -> Result<RedisBroker, KojinError>
pub async fn new(config: RedisConfig) -> Result<RedisBroker, KojinError>
Create a new Redis broker from config.
Sourcepub async fn poll_scheduled(&self) -> Result<usize, KojinError>
pub async fn poll_scheduled(&self) -> Result<usize, KojinError>
Poll the scheduled set and move due items to their queues.
Trait Implementations§
Source§impl Broker for RedisBroker
impl Broker for RedisBroker
Source§fn enqueue<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
fn enqueue<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
Push a message onto a queue.
Source§fn dequeue<'life0, 'life1, 'async_trait>(
&'life0 self,
queues: &'life1 [String],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskMessage>, KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBroker: 'async_trait,
fn dequeue<'life0, 'life1, 'async_trait>(
&'life0 self,
queues: &'life1 [String],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskMessage>, KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBroker: 'async_trait,
Blocking dequeue from one of the given queues.
Returns
None if shutdown is signaled or timeout occurs.Source§fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBroker: 'async_trait,
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBroker: 'async_trait,
Acknowledge successful processing — remove from processing queue.
Source§fn nack<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
fn nack<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
Negative acknowledge — message will be re-enqueued or dead-lettered.
Source§fn dead_letter<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
fn dead_letter<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
Move a message to the dead-letter queue.
Source§fn schedule<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
eta: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
fn schedule<'life0, 'async_trait>(
&'life0 self,
message: TaskMessage,
eta: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), KojinError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBroker: 'async_trait,
Schedule a message for future delivery.
Source§impl Clone for RedisBroker
impl Clone for RedisBroker
Source§fn clone(&self) -> RedisBroker
fn clone(&self) -> RedisBroker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RedisBroker
impl !RefUnwindSafe for RedisBroker
impl Send for RedisBroker
impl Sync for RedisBroker
impl Unpin for RedisBroker
impl UnsafeUnpin for RedisBroker
impl !UnwindSafe for RedisBroker
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more