StreamWeave
Composable, async, stream-first computation in pure Rust
Build fully composable, async data pipelines using a fluent API.
StreamWeave is a general-purpose Rust framework built around the concept of streaming data, with a focus on simplicity, composability, and performance. It supports WASM targets for the browser or server and does not rely on browser-specific stream primitives.
โจ Key Features
โ Implemented
- Pure Rust API with zero-cost abstractions
- Full async/await compatibility via
futures::Stream - Fluent pipeline-style API with type-safe builder pattern
- Comprehensive error handling system with multiple strategies (Stop, Skip, Retry, Custom)
- Code-as-configuration โ no external DSLs
- Comprehensive test infrastructure
- Integration Examples: Kafka, Redis Streams, Database (PostgreSQL/MySQL/SQLite), HTTP Polling
- File Format Support: CSV, JSONL, Parquet with streaming parsing
- Stateful Processing: RunningSum, MovingAverage transformers
- Exactly-Once Processing: Message deduplication with configurable windows
- Windowing Operations: Tumbling, sliding, and count-based windows
- Advanced Transformers: CircuitBreaker, Retry, Batch, RateLimit
- Common Transformers: Map, Filter, Flatten, Reduce, and many more
- HTTP middleware support with Axum integration
- WebSocket support
- Server-Sent Events support
๐ง Planned
- Support distributed processing
- Fan-in/fan-out support
- WASM-specific optimizations and documentation
- Additional specialized transformers and utilities
- Reusable pipeline components
- Add machine learning integration
- Implement monitoring and metrics
- Add SQL-like querying
- Add visualization tools
๐ฆ Core Concepts
StreamWeave breaks computation into three primary building blocks:
| Component | Description |
|---|---|
| Producer | Starts a stream of data |
| Transformer | Transforms stream items (e.g., map/filter) |
| Consumer | Consumes the stream, e.g. writing, logging |
All components can be chained together fluently.
๐ Example Pipeline
โ Currently Possible
use ;
async
๐งฑ API Overview
โ Implemented Pipeline Construction
new
.producer // Add data source
.transformer // Add transformation
.consumer // Add data sink
.run // Execute pipeline
โ Error Handling
StreamWeave provides two levels of error handling:
- Pipeline Level
// Default behavior: Pipeline stops on first error
pipeline.run.await?;
// Configure pipeline-wide error handling
pipeline
.with_error_strategy // Default
.with_error_strategy // Skip errored items
.with_error_strategy // Retry 3 times
.run
.await?;
- Component Level
// Override error handling for specific components
new
.with_error_strategy // Stop component and pipeline
.with_error_strategy // Skip errors, continue processing
.with_error_strategy // Retry operation 3 times
.with_error_strategy;
๐ Getting Started
Installation
Add StreamWeave to your Cargo.toml:
[]
= "0.2.1"
Basic Usage
use ;
async
๐งช Testing Pipelines
โ Implemented
The framework includes comprehensive test infrastructure for unit testing pipelines and components:
// Example from the test suite
let producer = NumberProducer ;
let transformer = StringifyTransformer;
let consumer = CollectConsumer ;
let = new
.producer
.transformer
.consumer
.run
.await
.unwrap;
assert_eq!;
๐ Documentation
- API Documentation
- Local Documentation - Generated with Doxidize (run
./bin/docs) - Getting Started Guide
- Architecture Overview
- Common Use Cases
- Troubleshooting
- Contributing Guide
๐ Examples
StreamWeave includes comprehensive examples demonstrating all major features:
Integration Examples
- Kafka Integration - Produce to and consume from Kafka topics
- Redis Streams Integration - XADD and XREAD operations with consumer groups
- Database Integration - Query PostgreSQL, MySQL, and SQLite with streaming results
- HTTP Polling Integration - Poll HTTP endpoints with pagination, delta detection, and rate limiting
File Format Examples
- File Formats - CSV, JSONL, and Parquet read/write with streaming parsing
Processing Examples
- Stateful Processing - RunningSum and MovingAverage transformers
- Error Handling - Stop, Skip, Retry, and Custom error strategies
- Advanced Transformers - CircuitBreaker, Retry, Batch, RateLimit
- Windowing Operations - Tumbling, sliding, and count-based windows
- Exactly-Once Processing - Message deduplication and checkpointing
Basic Examples
- Basic Pipeline - Simple pipeline example
- Advanced Pipeline - Complex pipeline patterns
Run any example with:
๐ค Contributing
Contributions are welcome! Please see our Contributing Guide for details.
๐ License
This project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
See LICENSE for details.