Эта страница ещё не переведена
Ниже показан английский оригинал.
Messages
A publish policy with a fixed ordering key writes it into the googlepubsub binding of the message the mount site sends.
The message binding of googlepubsub describes what a message carries beyond its payload and attributes.
This crate fills orderingKey where the mount site's policy fixed one.
A key named per message, by the ordering_key step or the partition-key header, is named at a call site, which the document does not see.
A message whose mount site fixed no key carries no binding.
Example
Every receipt goes out under the key receipts.
- Macros
- Manual
fn service(broker: PubSubBroker) -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders", "1.0.0")).with_broker_labeled("pubsub", broker, |b| {
// Every receipt goes out under one key, so the document states it.
b.include(receipt)
.out_reply(Publish::default().ordering_key("receipts"));
})
}
fn service(broker: PubSubBroker) -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders", "1.0.0")).with_broker_labeled("pubsub", broker, |b| {
// Every receipt goes out under one key, so the document states it.
b.include(subscriber(orders(), ReceiptFor).reply().build())
.out_reply(Publish::default().ordering_key("receipts"));
})
}
The message Receipt in the document:
{
"googlepubsub": {
"orderingKey": "receipts",
"bindingVersion": "0.2.0"
}
}