Module streaming

Module streaming 

Source
Expand description

Streaming rule engine for real-time event processing Rule Streaming Engine - Real-time Event Processing

This module provides real-time rule execution capabilities for streaming data, including time-based windows, event aggregation, and continuous rule evaluation.

§Features

  • 🔄 Continuous Processing: Non-stop rule evaluation on incoming events
  • ⏰ Time Windows: Sliding and tumbling window aggregations
  • 📊 Stream Analytics: Count, sum, average, min/max over time windows
  • 🎯 Event Filtering: Pattern matching and event correlation
  • ⚡ High Throughput: Async processing with backpressure handling

§Example

use rust_rule_engine::streaming::*;

let mut stream_engine = StreamRuleEngine::new()
    .with_window_size(Duration::from_secs(60))
    .with_buffer_size(1000);

// Define streaming rule
let rule = r#"
rule "HighFrequencyTrading" {
    when
        stream(TradeEvent, 5s).count() > 100
    then
        AlertService.trigger("High frequency detected");
}
"#;

stream_engine.add_rule(rule).await?;
stream_engine.start().await?;

Re-exports§

pub use aggregator::AggregationType;
pub use aggregator::Aggregator;
pub use engine::StreamRuleEngine;
pub use event::EventMetadata;
pub use event::StreamEvent;
pub use window::TimeWindow;
pub use window::WindowManager;
pub use window::WindowType;
pub use operators::DataStream;
pub use operators::KeyedStream;
pub use operators::WindowedStream;
pub use operators::WindowConfig;
pub use operators::GroupedStream;
pub use operators::Aggregation;
pub use operators::AggregateResult;
pub use operators::Count;
pub use operators::Sum;
pub use operators::Average;
pub use operators::Min;
pub use operators::Max;
pub use operators::CustomAggregator;
pub use state::StateStore;
pub use state::StateBackend;
pub use state::StateConfig;
pub use state::StatefulOperator;
pub use state::CheckpointMetadata;
pub use state::StateStatistics;
pub use watermark::Watermark;
pub use watermark::WatermarkStrategy;
pub use watermark::WatermarkGenerator;
pub use watermark::LateDataStrategy;
pub use watermark::LateDataHandler;
pub use watermark::WatermarkedStream;
pub use watermark::LateEventDecision;
pub use watermark::LateDataStats;

Modules§

aggregator
Stream Aggregation Functions
engine
Streaming Rule Engine
event
Stream Event Types and Metadata
operators
Stream Operators - Fluent API for Stream Processing
state
State Management for Stream Processing
watermark
Watermark and Late Data Handling
window
Time Window Management for Stream Processing