pub struct RedisDefaultPublish;Expand description
The broker’s default policy, what a registration publishes through when its mount site names none: a reply, a retry copy, a dead-letter move.
It writes each name the way this service reads it. A name a RedisList subscription reads,
or dead-letters to, is LPUSHed in that subscription’s framing; a name a RedisPubSub
subscription reads or dead-letters to is published on in its mode and framing; any other name,
a stream key included, is XADDed. So a retry copy and a dead-letter move leave through the
publish of the form the delivery came from, with nothing named at the mount site.
The route is recorded when a subscription opens, so a name this service does not subscribe to is a stream. A pattern subscription records nothing: its mount site names both the destination and the policy of its copies.
§Examples
use ruststream_fred::RedisList;
use ruststream_fred::stream::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
struct Order {
id: u64,
}
#[derive(Deserialize, Serialize, Outgoing)]
#[outgoing(name = "jobs")]
struct Job {
order: u64,
}
#[subscriber(RedisStream::new("orders").group("planners"), reply)]
async fn plan(order: &Order) -> Job {
Job { order: order.id }
}
#[subscriber(RedisList::new("jobs").reliable())]
async fn work(job: &Job) -> HandlerOutcome {
tracing::info!(job.order, "job");
HandlerOutcome::ack()
}
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
RedisBroker::standalone("redis://localhost:6379"),
|b| {
// The reply names no policy, so it leaves through the default one: `jobs` is
// read as a list here, so the reply is an `LPUSH`.
b.include(plan);
b.include(work);
},
)
}Trait Implementations§
Source§impl Clone for RedisDefaultPublish
impl Clone for RedisDefaultPublish
impl Copy for RedisDefaultPublish
Source§impl Debug for RedisDefaultPublish
impl Debug for RedisDefaultPublish
Source§impl Default for RedisDefaultPublish
impl Default for RedisDefaultPublish
impl Eq for RedisDefaultPublish
Source§impl PartialEq for RedisDefaultPublish
impl PartialEq for RedisDefaultPublish
Source§impl PublishPolicy<ConnectedRedisBroker> for RedisDefaultPublish
impl PublishPolicy<ConnectedRedisBroker> for RedisDefaultPublish
Source§fn channel_bindings(&self, channel: &str) -> Bindings
fn channel_bindings(&self, channel: &str) -> Bindings
Described as the stream publish, the family of a name no subscription of the service reads; the document is built before any subscription opens, so a name that turns out to be read as a list or a channel is described as a stream.
Source§type Live = RedisDefaultPublisher
type Live = RedisDefaultPublisher
Publisher for a leaf policy, or the live
wiring form for a combinator stack (a typed publisher over a policy pairs into the same
typed publisher over the live leaf).Source§fn pair(
self,
connected: &ConnectedRedisBroker,
) -> impl Future<Output = Result<Self::Live, PairError>>
fn pair( self, connected: &ConnectedRedisBroker, ) -> impl Future<Output = Result<Self::Live, PairError>>
Source§fn operation_bindings(&self, channel: &str) -> Bindings
fn operation_bindings(&self, channel: &str) -> Bindings
send operation in the document. Read moreimpl StructuralPartialEq for RedisDefaultPublish
Auto Trait Implementations§
impl Freeze for RedisDefaultPublish
impl RefUnwindSafe for RedisDefaultPublish
impl Send for RedisDefaultPublish
impl Sync for RedisDefaultPublish
impl Unpin for RedisDefaultPublish
impl UnsafeUnpin for RedisDefaultPublish
impl UnwindSafe for RedisDefaultPublish
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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