pub trait WindowMode:
Sealed
+ Send
+ Sync
+ 'static {
const ATOMIC: bool;
}Expand description
The two modes of a window, Plain and Atomic.
§Examples
use ruststream_fred::stream::prelude::*;
#[subscriber(RedisStream::new("{orders}").group("workers"))]
async fn invoice(order: &Order, Ctx(pipeline): Ctx<keys::Pipeline>) -> HandlerOutcome {
match pipeline.lpush("{orders}:invoices", order.id.to_string()).await {
Ok(()) => HandlerOutcome::ack(),
Err(_) => HandlerOutcome::retry(),
}
}
fn app() -> RustStream {
RustStream::new(AppInfo::new("invoices", "0.1.0")).with_broker(
RedisBroker::standalone("redis://localhost:6379"),
|b| {
// `.pipeline()` opens the window as `Plain`, and `.atomic()` makes it `Atomic`.
b.include(invoice.pipeline().atomic());
},
)
}Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".