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

下面显示的是英文原文。

Channels

A publish channel reports its socket pair and, on PUSH/PULL and PUB/SUB, nameFrame: the frame 0 a peer sends or subscribes with.

Each destination a mount site publishes to is a channel of the document. Its x-ruststream-zeromq extension comes from the publish policy, so it says how messages leave this service. socketPair is PUSH/PULL, PUB/SUB or DEALER/ROUTER. nameFrame is the value frame 0 holds on the wire, which is the destination itself. A peer reads from it what to send to reach the channel and, on PUB/SUB, which prefix to subscribe with.

A responder's reply channel reports no nameFrame. An answer travels to the identity the ROUTER supplies, and its frame 0 always holds reply, so the channel's own name reaches no peer.

Peers in other languages shows which frame 0 a peer sends or subscribes with.

Example​

The worker's results go to results over PUSH/PULL, so the channel reports nameFrame: results.

// No destination of its own: the clause names `results`, the name frame of every result.
#[derive(Debug, Serialize, Outgoing)]
struct Done {
id: u64,
}

#[subscriber("jobs", reply("results"))]
async fn work(job: &Job) -> Done {
tracing::info!(job.id, "working");
Done { id: job.id }
}