Messages
A policy with a partition key reports it on the message object, since a key routes one record and names no stream.
A key named on the policy with KinesisPublishSettings applies to every record that leaves through it.
So the message object of those records carries it as partitionKey in its x-ruststream-kinesis object.
The stream stays on the channel: one message type published to two streams describes both with one message object.
A policy with no key adds no object to the message.
A key named on one publish with the partition_key step describes one record, not the mount, so it is not in the document.
Example
The receipts leave through a policy keyed tenant-acme.
- Macros
- Manual
fn service(broker: KinesisBroker) -> RustStream {
// The label is the server's key in the document.
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker_labeled("kinesis", broker, |b| {
// Every receipt carries one key, so they share a shard and keep their order.
b.include(confirm)
.out_reply(Publish::default())
.partition_key("tenant-acme");
})
}
fn service(broker: KinesisBroker) -> RustStream {
// The label is the server's key in the document.
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker_labeled("kinesis", broker, |b| {
// Every receipt carries one key, so they share a shard and keep their order.
b.include(subscriber(orders(), Confirm).reply().build())
.out_reply(Publish::default())
.partition_key("tenant-acme");
})
}
The message object of Receipt in the document:
{
"x-ruststream-kinesis": {
"partitionKey": "tenant-acme"
}
}