跳到主要内容
本页尚未翻译

下面显示的是英文原文。

InRound

The InRound transform on the reply position puts a handler's reply into its delivery's round, after the commands it queued.

The transform chains after the reply policy: .out_reply(Publish).transform(InRound). The reply then leaves with the delivery's settle, in the window's pipeline, and only when the delivery is acknowledged. It follows what the handler queued and published through a bound slot, so a reader sees the handler's writes in the order the handler made them. Without the transform a reply is an ordinary publish: it leaves as the handler returns, before the window sends what the handler queued. The transform writes the crate's per-message options, so it mounts only where this crate's policies publish.

Example​

The reply confirms the order on the same log the bound slot wrote to; with InRound the log reads accepted, then confirmed.

#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
RedisBroker::standalone("redis://localhost:6379"),
|b| {
// The reply joins the delivery's round after the bound entry, so the log keeps the
// order the handler wrote them in.
b.include(accept.pipeline())
.out_reply(Publish)
.transform(InRound)
.out(DefaultSlot, Publish)
.build();
},
)
}