1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! The imports a service on Kinesis writes every time, in one glob.
//!
//! The framework's own prelude, the broker, its subscription descriptor and the settings that
//! chain onto a mount site, its positions and seeker, the delivery context with the keys that
//! read it, and its publish policy with the settings that chain onto that and the per-message
//! steps that ride the publish builder.
//!
//! A service writes two kinds of file, and they import different things. A handler body names
//! only what it needs of the framework (`use ruststream::prelude::*`) and bounds an injected
//! publisher with a capability trait, so it never learns which broker it runs on. The file that
//! mounts those handlers imports this glob, where the broker's policies and context keys carry
//! their concept name with the prefix stripped - [`Publish`] here - so a mount site reads the
//! same on every broker; each prefixed original stays at the crate root, for a file that mounts
//! two brokers and has to say which [`Publish`] it means.
//!
//! The one handler body that imports this glob is the one that names a per-message setting: it
//! takes [`partition_key`](KinesisPublishSteps::partition_key) from here and bounds its slot as
//! `Out<impl Publisher<Options = KinesisPublishOptions>, Marker>`, which says in the signature
//! that the body runs on Kinesis.
//!
//! # Examples
//!
//! ```
//! # mod demo {
//! use std::time::Duration;
//!
//! use ruststream_kinesis::prelude::*;
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Deserialize)]
//! struct Order {
//! id: u64,
//! }
//!
//! #[derive(Serialize, Outgoing)]
//! #[outgoing(name = "receipts")]
//! struct Receipt {
//! order: u64,
//! }
//!
//! #[subscriber(KinesisStream::new("orders").poll_interval(Duration::from_millis(500)), reply)]
//! async fn confirm(order: &Order, Ctx(at): Ctx<Position>) -> Receipt {
//! println!("order {} sits at {at:?}", order.id);
//! Receipt { order: order.id }
//! }
//!
//! #[ruststream::app]
//! fn app() -> impl App {
//! RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(KinesisBroker::new(), |b| {
//! b.include(confirm).out_reply(Publish::default());
//! })
//! }
//! # }
//! # fn main() {}
//! ```
pub use *;
// `Partitioned` is implemented here but stays out: the core surfaces `partition_key` through
// `IncomingMessage`'s defaulted method, so re-exporting the trait makes the natural call ambiguous.
pub use ;
pub use crateKinesisBroker;
pub use crate;
pub use crateDynamoLeaseStore;
pub use crateKinesisPosition;
// The options type keeps its prefix: it is not a policy or a context key but the name a handler
// body writes in its own bound (`Out<impl Publisher<Options = KinesisPublishOptions>, Marker>`),
// and that body says which broker it is tied to.
pub use crate;
pub use crate;
pub use crateKinesisSeeker;