mkdir my_first_dataflow
cd my_first_dataflow
Cargo.toml
[workspace]
members = [
"rust-dataflow-example-node",
]
Let's write a node which sends the current time periodically. Let's make it after 100 iterations. The other nodes/operators will then exit as well because all sources closed.
cargo new rust-dataflow-example-node
with Cargo.toml:
{{#include ../../examples/rust-dataflow/node/Cargo.toml}}
with src/main.rs:
{{#include ../../examples/rust-dataflow/node/src/main.rs}}
cargo new rust-dataflow-example-operator --lib
with Cargo.toml:
{{#include ../../examples/rust-dataflow/operator/Cargo.toml}}
with src/lib.rs:
{{#include ../../examples/rust-dataflow/operator/src/lib.rs}}
Cargo.toml:[workspace]
members = [
"rust-dataflow-example-node",
"rust-dataflow-example-operator",
]
Let's write a logger which will print incoming data.
cargo new sink_logger
with Cargo.toml:
{{#include ../../examples/rust-dataflow/sink/Cargo.toml}}
with src/main.rs:
{{#include ../../examples/rust-dataflow/sink/src/main.rs}}
Cargo.toml:[workspace]
members = [
"rust-dataflow-example-node",
"rust-dataflow-example-operator",
"rust-dataflow-example-sink"
]
cargo build --all --release
Let's write the graph definition so that the nodes know who to communicate with.
dataflow.yml
{{#include ../../examples/rust-dataflow/dataflow.yml}}
dataflow:dora-coordinator --run-dataflow dataflow.yml dora-runtime