Skip to main content

RedisPubSubPatternPipeline

Type Alias RedisPubSubPatternPipeline 

Source
pub type RedisPubSubPatternPipeline = Pipelined<RedisPubSubPattern, Plain>;
Expand description

A Pub/Sub pattern subscription with a window: what .pipeline() at the mount site makes of a RedisPubSubPattern.

§Examples

use ruststream_fred::pubsub::prelude::*;

#[subscriber(RedisPubSubPattern::new("events.*"))]
async fn record(event: &Event, Ctx(pipeline): Ctx<keys::Pipeline>) -> HandlerOutcome {
    if pipeline.incr(format!("seen:{}", event.id)).await.is_err() {
        return HandlerOutcome::retry();
    }
    HandlerOutcome::ack()
}

fn app() -> RustStream {
    RustStream::new(AppInfo::new("events", "0.1.0")).with_broker(
        RedisBroker::standalone("redis://localhost:6379"),
        |b| {
            // The source of this registration is a `RedisPubSubPatternPipeline`.
            b.include(record.pipeline());
        },
    )
}

Aliased Type§

pub struct RedisPubSubPatternPipeline { /* private fields */ }