Expand description
Stream Operators - Fluent API for Stream Processing
This module provides a fluent, composable API for building stream processing pipelines. Inspired by Apache Flink, Kafka Streams, and Rust iterators.
§Example
ⓘ
use rust_rule_engine::streaming::*;
let result = DataStream::from_events(events)
.filter(|e| e.get_numeric("amount").unwrap_or(0.0) > 100.0)
.map(|e| enhance_event(e))
.key_by(|e| e.get_string("user_id").unwrap_or("unknown").to_string())
.window(WindowConfig::sliding(Duration::from_secs(60)))
.reduce(|acc, e| {
let sum = acc.get_numeric("total").unwrap_or(0.0);
let amount = e.get_numeric("amount").unwrap_or(0.0);
acc.data.insert("total".to_string(), Value::Number(sum + amount));
acc
})
.collect();Structs§
- Average
- Average aggregator
- Count
- Count aggregator
- Custom
Aggregator - Custom aggregator using a closure
- Data
Stream - A stream of events with chainable operators
- Grouped
Stream - Grouped stream for aggregations
- Keyed
Stream - A stream of events keyed by a specific field
- Keyed
Windowed Stream - Keyed stream with windowing
- Max
- Max aggregator
- Min
- Min aggregator
- Sum
- Sum aggregator
- Window
Config - Window configuration for stream processing
- Windowed
Stream - A stream with windowing applied
Enums§
- Aggregate
Result - Result of an aggregation operation
Traits§
- Aggregation
- Trait for aggregation functions