pub struct RedisConsumer { /* private fields */ }Expand description
Redis consumer implementation supporting both Pub/Sub and Queue modes.
Implementations§
Source§impl RedisConsumer
impl RedisConsumer
Sourcepub fn new(config: RedisEndpointConfig) -> Self
pub fn new(config: RedisEndpointConfig) -> Self
Creates a new RedisConsumer with the given configuration.
The mode is automatically determined from the command type in the config:
- SUBSCRIBE → PubSub with channels
- PSUBSCRIBE → PubSub with patterns
- BLPOP/BRPOP → Queue mode
Trait Implementations§
Source§impl Consumer for RedisConsumer
impl Consumer for RedisConsumer
Source§fn concurrency_model(&self) -> ConcurrencyModel
fn concurrency_model(&self) -> ConcurrencyModel
Redis consumers are sequential by default to maintain message order.
This default is chosen for the following reasons:
- Pub/Sub: Messages often need ordering (e.g., event streams, notifications)
- Queue (BLPOP): Queue items should be processed in order
- Backpressure: Sequential processing naturally applies backpressure when the consumer is slower than the producer
Users can override this with .concurrent(n) in the route DSL if they
want parallel processing and ordering is not a concern.
Auto Trait Implementations§
impl Freeze for RedisConsumer
impl RefUnwindSafe for RedisConsumer
impl Send for RedisConsumer
impl Sync for RedisConsumer
impl Unpin for RedisConsumer
impl UnsafeUnpin 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