Module operators

Module operators 

Source
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
CustomAggregator
Custom aggregator using a closure
DataStream
A stream of events with chainable operators
GroupedStream
Grouped stream for aggregations
KeyedStream
A stream of events keyed by a specific field
KeyedWindowedStream
Keyed stream with windowing
Max
Max aggregator
Min
Min aggregator
Sum
Sum aggregator
WindowConfig
Window configuration for stream processing
WindowedStream
A stream with windowing applied

Enums§

AggregateResult
Result of an aggregation operation

Traits§

Aggregation
Trait for aggregation functions