Overview
Event pipelines provide a declarative way to process events through a series of filter and action steps. Pipelines enable complex event processing logic without writing custom handlers. Location:crates/oneclaw-core/src/event_bus/pipeline.rs
Pipeline Concept
A pipeline is a series of steps: Filter → Transform → Action- Filter: Check if event matches criteria
- Actions: Modify event or emit new events
- Pass to next step with modified event
Pipeline Structure
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:89
PipelineStep
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:78
Filter Operations
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:10
Filter Examples
Pipeline Actions
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:55
Action Examples
Building Pipelines
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:100
Processing Events
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:115
Filter-Transform-Route Patterns
Threshold Detection
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:212
Multi-Step Processing
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:265
Event Enrichment
Routing by Type
Topic Matching
Location:crates/oneclaw-core/src/event_bus/pipeline.rs:154
Pipeline Configuration Examples
Temperature Monitoring
Device Status Monitoring
Integration with EventBus
Pipelines can be used with EventBus handlers:Benefits of Pipelines
- Declarative: Define processing logic as data, not code
- Composable: Chain multiple steps for complex logic
- Testable: Easy to test filter and action combinations
- Configurable: Pipelines can be loaded from config files
- Maintainable: Clear separation of concerns
Use Cases
- Alert generation: Threshold violations, anomaly detection
- Event routing: Route events to different topics based on content
- Data enrichment: Add metadata, timestamps, computed fields
- Priority adjustment: Escalate/de-escalate based on conditions
- Logging and debugging: Conditional logging of events
- Event transformation: Normalize event formats
Related
- EventBus Trait - Core interface
- DefaultEventBus - Synchronous bus implementation
- AsyncEventBus - Asynchronous bus implementation