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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//! Fluvio adapter — streaming reads (consumer) and writes (producer) for Fluvio topics.
//!
//! Provides two graph nodes:
//!
//! - [`fluvio_sub`] — producer that streams records from a Fluvio topic partition
//! - [`fluvio_pub`] — consumer that writes records to a Fluvio topic
//!
//! # Setup
//!
//! ## Local (Docker)
//!
//! Start a single-node Fluvio cluster:
//!
//! ```sh
//! docker run --rm -d -p 9003:9003 -p 9010:9010 \
//! --name fluvio-sc \
//! infinyon/fluvio:0.18.1 \
//! fluvio-run sc --local /tmp/fluvio
//! ```
//!
//! Create a topic before producing or consuming:
//!
//! ```sh
//! fluvio topic create my-topic
//! ```
//!
//! # Subscribing to a topic
//!
//! [`fluvio_sub`] streams records from a Fluvio topic partition starting at the
//! specified offset (or from the beginning if `start_offset` is `None`).
//!
//! ```ignore
//! use wingfoil::adapters::fluvio::*;
//! use wingfoil::*;
//!
//! let conn = FluvioConnection::new("127.0.0.1:9003");
//!
//! fluvio_sub(conn, "my-topic", 0, None)
//! .collapse()
//! .for_each(|event, _| {
//! println!("offset={} value={:?}", event.offset, event.value_str())
//! })
//! .run(RunMode::RealTime, RunFor::Forever)
//! .unwrap();
//! ```
//!
//! # Publishing records to a topic
//!
//! [`fluvio_pub`] (or the fluent `.fluvio_pub()` method) consumes a
//! `Burst<FluvioRecord>` stream and writes each record to a Fluvio topic.
//!
//! ```ignore
//! use wingfoil::adapters::fluvio::*;
//! use wingfoil::*;
//!
//! let conn = FluvioConnection::new("127.0.0.1:9003");
//!
//! constant(burst![
//! FluvioRecord::with_key("greeting", b"hello".to_vec()),
//! FluvioRecord::new(b"world".to_vec()),
//! ])
//! .fluvio_pub(conn, "my-topic")
//! .run(RunMode::RealTime, RunFor::Cycles(1))
//! .unwrap();
//! ```
//!
//! # Round-trip example
//!
//! See [`examples/fluvio`](https://github.com/wingfoil-io/wingfoil/tree/main/wingfoil/examples/fluvio)
//! for a full working example that seeds records with `fluvio_pub`, reads them back
//! with `fluvio_sub`, and transforms the values.
pub use *;
pub use *;
/// Connection configuration for a Fluvio cluster.
/// A record to write to a Fluvio topic.
/// A record received from a Fluvio topic.