下面显示的是英文原文。
Operations
A channel a service publishes to reports where the publish lands, a key or a channel, with its delivery mode, expiry and framing.
The publish policy describes the channel, in the word Redis uses for the destination.
A stream publisher reports the key it appends to, and nothing else.
A list publisher reports its key, the ttlMs every push re-arms, and its envelope.
A Pub/Sub publisher reports its channel, the mode it publishes in, and its envelope.
The destination is the one the mount site resolved: a reply("..") clause, a reply type's #[outgoing(name)], or an entry of a slot.
So a reply declared with reply("orders.done") reports orders.done, whichever subscription produced it.
A dead-letter destination is reported as a channel the service publishes to.
Example
The reply of orders goes out on the Pub/Sub channel orders.done.
The reply of jobs goes to the list jobs.done, which expires a minute after the last push.
- Macros
- Manual
fn service(broker: RedisBroker) -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders", "1.0.0")).with_broker_labeled("redis", broker, |b| {
b.include(confirm).out_reply(pubsub::Publish::new());
b.include(run_job)
.out_reply(list::Publish::new().ttl(Duration::from_mins(1)));
b.include(on_event);
b.include(audit);
})
}
fn service(broker: RedisBroker) -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders", "1.0.0")).with_broker_labeled("redis", broker, |b| {
b.include(
subscriber(orders(), Confirm)
.reply()
.to("orders.done")
.build(),
)
.out_reply(pubsub::Publish::new());
b.include(subscriber(jobs(), Confirm).reply().to("jobs.done").build())
.out_reply(list::Publish::new().ttl(Duration::from_mins(1)));
b.include(subscriber(events(), Log("event")).build());
b.include(subscriber(audit(), Log("audit")).build());
})
}