Skip to main content

dataflow_rs/
prelude.rs

1//! Common imports for building dataflow-rs engines and handlers.
2//!
3//! `use dataflow_rs::prelude::*;` brings in the types you need for the 90%
4//! case: engine construction, custom handler authoring, message
5//! processing, error handling.
6//!
7//! ```rust,no_run
8//! use dataflow_rs::prelude::*;
9//! use serde_json::json;
10//!
11//! # async fn run() -> Result<()> {
12//! let engine = Engine::builder()
13//!     // .register("my_handler", MyHandler)
14//!     .build()?;
15//!
16//! let mut message = Message::builder()
17//!     .payload_json(&json!({"order": {"total": 1500}}))
18//!     .build();
19//!
20//! engine.process_message(&mut message).await?;
21//! # Ok(()) }
22//! ```
23//!
24//! Types not re-exported here (because they're only needed for less-common
25//! flows): `BoxedFunctionHandler`, `DynAsyncFunctionHandler`,
26//! `CompiledCustomInput`, the named `*Config` structs (`MapConfig`,
27//! `ValidationConfig`, etc.), the trace surface (`ExecutionTrace`,
28//! `ExecutionStep`, `StepResult`), and the rules-engine aliases
29//! (`Rule`, `Action`, `RulesEngine`). Reach into the crate root for those.
30
31pub use crate::engine::error::{DataflowError, ErrorInfo, Result};
32pub use crate::engine::functions::AsyncFunctionHandler;
33pub use crate::engine::message::{AuditTrail, Change, Message, MessageBuilder};
34pub use crate::engine::task_context::TaskContext;
35pub use crate::engine::task_outcome::TaskOutcome;
36pub use crate::engine::{Engine, EngineBuilder, Task, Workflow, WorkflowStatus};