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
76
77
78
79
80
81
82
83
84
85
//! The imports a service on Kafka writes every time, in one glob.
//!
//! `use ruststream_rdkafka::prelude::*;` carries the core's own prelude plus this crate's broker,
//! subscription descriptor and its options, publish policies, reply transform, per-delivery
//! context keys, and the capability traits a handler names. The
//! [Prelude](https://powersemmi.github.io/ruststream-rdkafka/latest/components/broker/prelude/)
//! page shows it in a service.
//!
//! # Two vocabularies, two files
//!
//! A handler body imports `ruststream::prelude::*` and bounds an injected slot with the
//! **capability trait** it needs - `Out<impl Publisher>`, `Out<impl TransactionalPublisher>`,
//! `Out<impl PartitionLanes>` - so it names no broker type at all. A mount site imports this
//! prelude, which carries the core one plus the **policies** under their concept names:
//! [`Publish`], [`TransactionalPublish`], [`PartitionedPublish`], [`EosPublish`]. Include sites
//! therefore read the same on every broker, and the two vocabularies never meet in one file.
//!
//! | Prelude name | Type |
//! | --- | --- |
//! | [`Publish`] | [`KafkaPublish`](crate::KafkaPublish) |
//! | [`TransactionalPublish`] | [`KafkaTransactionalPublish`](crate::KafkaTransactionalPublish) |
//! | [`PartitionedPublish`] | [`KafkaPartitionedPublish`](crate::KafkaPartitionedPublish) |
//! | [`EosPublish`] | [`KafkaEosPublish`](crate::KafkaEosPublish) |
//!
//! One handler body imports this prelude too: the one that adjusts a per-record setting. Naming
//! [`KafkaPublishSteps`]'s `partition(..)` step needs the trait in
//! scope and the slot bounded as `Out<impl Publisher<Options = KafkaOptions>, Marker>`, and that
//! bound is the stated exception to the rule above.
//!
//! Globbing two broker preludes conflicts on these names where one is used (E0659); the prefixed
//! types at the crate root are the disambiguation.
//!
//! # Examples
//!
//! ```
//! use ruststream_rdkafka::prelude::*;
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Deserialize)]
//! struct Order {
//! id: u64,
//! }
//!
//! #[derive(Serialize, Outgoing)]
//! #[outgoing(name = "confirmations")]
//! struct Confirmation {
//! id: u64,
//! }
//!
//! #[subscriber(
//! KafkaTopic::new("orders")
//! .commit(Commit::Tracked)
//! .start(StartOffset::Earliest),
//! reply
//! )]
//! async fn confirm(order: &Order) -> Confirmation {
//! Confirmation { id: order.id }
//! }
//!
//! fn app() -> RustStream {
//! RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
//! KafkaBroker::new(["localhost:9092"]).default_group("orders-svc"),
//! |b| {
//! b.include(confirm).out_reply(Publish::default());
//! },
//! )
//! }
//! # let _ = app;
//! ```
pub use *;
pub use ;
pub use crate;
pub use crate::;
// `Partitioned` stays out: the core's defaulted `IncomingMessage::partition_key` is already in
// scope, so re-exporting the trait makes the natural call ambiguous (E0034).