|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +logo: ./logo.svg |
| 4 | +--- |
| 5 | + |
| 6 | +# Introduction |
| 7 | + |
| 8 | +ArkFlow is a high-performance Rust stream processing engine that provides powerful data stream processing capabilities, supporting various input/output sources and processors. |
| 9 | + |
| 10 | +:::tip |
| 11 | +Currently, ArkFlow is **stateless**, but it can still help you solve most data engineering problems. It implements transaction-based resilience and features backpressure. |
| 12 | + |
| 13 | +Therefore, when connected to input and output sources that provide at-least-once semantics, it can guarantee at-least-once delivery without needing to retain messages in transit. |
| 14 | + |
| 15 | +In the future, we will gradually improve the functions of ArkFlow to enable it to have transactional and state management capabilities, so as to better meet various data processing needs. |
| 16 | + |
| 17 | +::: |
| 18 | + |
| 19 | + |
| 20 | +logo([Logo Usage Guidelines](./about-logo)): |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +## Core Features |
| 26 | + |
| 27 | +- **High Performance**: Built on Rust and Tokio async runtime, delivering exceptional performance and low latency |
| 28 | +- **Multiple Data Sources**: Support for Kafka, MQTT, HTTP, files, and other input/output sources |
| 29 | +- **Powerful Processing**: Built-in SQL queries, JSON processing, Protobuf encoding/decoding, batch processing, and other processors |
| 30 | +- **Extensibility**: Modular design, easy to extend with new input, output, and processor components |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +### Building from Source |
| 35 | + |
| 36 | +```bash |
| 37 | +# Clone repository |
| 38 | +git clone https://github.com/arkflow-rs/arkflow.git |
| 39 | +cd arkflow |
| 40 | + |
| 41 | +# Build project |
| 42 | +cargo build --release |
| 43 | + |
| 44 | +# Run tests |
| 45 | +cargo test |
| 46 | +``` |
| 47 | + |
| 48 | +## Quick Start |
| 49 | + |
| 50 | +1. Create a configuration file `config.yaml`: |
| 51 | + |
| 52 | +```yaml |
| 53 | +logging: |
| 54 | + level: info |
| 55 | +streams: |
| 56 | + - input: |
| 57 | + type: "generate" |
| 58 | + context: '{ "timestamp": 1625000000000, "value": 10, "sensor": "temp_1" }' |
| 59 | + interval: 1s |
| 60 | + batch_size: 10 |
| 61 | + buffer: |
| 62 | + type: "memory" |
| 63 | + capacity: 10 |
| 64 | + timeout: 10s |
| 65 | + pipeline: |
| 66 | + thread_num: 4 |
| 67 | + processors: |
| 68 | + - type: "json_to_arrow" |
| 69 | + - type: "sql" |
| 70 | + query: "SELECT * FROM flow WHERE value >= 10" |
| 71 | + |
| 72 | + output: |
| 73 | + type: "stdout" |
| 74 | + error_output: |
| 75 | + type: "stdout" |
| 76 | +``` |
| 77 | +
|
| 78 | +2. Run ArkFlow: |
| 79 | +
|
| 80 | +```bash |
| 81 | +./target/release/arkflow --config config.yaml |
| 82 | +``` |
| 83 | + |
| 84 | +## Configuration Guide |
| 85 | + |
| 86 | +ArkFlow uses YAML format configuration files and supports the following main configuration items: |
| 87 | + |
| 88 | +### Top-level Configuration |
| 89 | + |
| 90 | +```yaml |
| 91 | +logging: |
| 92 | + level: info # Log levels: debug, info, warn, error |
| 93 | + |
| 94 | +streams: # Stream definition list |
| 95 | + - input: # Input configuration |
| 96 | + # ... |
| 97 | + pipeline: # Pipeline configuration |
| 98 | + # ... |
| 99 | + output: # Output configuration |
| 100 | + # ... |
| 101 | + error_output: # Error output configuration |
| 102 | + # ... |
| 103 | + buffer: # Buffer configuration |
| 104 | + # ... |
| 105 | +``` |
| 106 | + |
| 107 | + |
| 108 | +### Input Components |
| 109 | + |
| 110 | +ArkFlow supports multiple input sources: |
| 111 | + |
| 112 | +- **Kafka**: Read data from Kafka topics |
| 113 | +- **MQTT**: Subscribe to messages from MQTT topics |
| 114 | +- **HTTP**: Receive data via HTTP |
| 115 | +- **File**: Reading data from files(Csv,Json, Parquet, Avro, Arrow) using SQL |
| 116 | +- **Generator**: Generate test data |
| 117 | +- **Database**: Query data from databases(MySQL, PostgreSQL, SQLite, Duckdb) |
| 118 | +- **Nats**: Subscribe to messages from Nats topics |
| 119 | +- **Redis**: Subscribe to messages from Redis channels or lists |
| 120 | +- **Websocket**: Subscribe to messages from WebSocket connections |
| 121 | + |
| 122 | +Example: |
| 123 | + |
| 124 | +```yaml |
| 125 | +input: |
| 126 | + type: kafka |
| 127 | + brokers: |
| 128 | + - localhost:9092 |
| 129 | + topics: |
| 130 | + - test-topic |
| 131 | + consumer_group: test-group |
| 132 | + client_id: arkflow |
| 133 | + start_from_latest: true |
| 134 | +``` |
| 135 | +
|
| 136 | +### Processors |
| 137 | +
|
| 138 | +ArkFlow provides multiple data processors: |
| 139 | +
|
| 140 | +- **JSON**: JSON data processing and transformation |
| 141 | +- **SQL**: Process data using SQL queries |
| 142 | +- **Protobuf**: Protobuf encoding/decoding |
| 143 | +- **Batch Processing**: Process messages in batches |
| 144 | +- **Vrl**: Process data using [VRL](https://vector.dev/docs/reference/vrl/) |
| 145 | +
|
| 146 | +Example: |
| 147 | +
|
| 148 | +```yaml |
| 149 | +pipeline: |
| 150 | + thread_num: 4 |
| 151 | + processors: |
| 152 | + - type: json_to_arrow |
| 153 | + - type: sql |
| 154 | + query: "SELECT * FROM flow WHERE value >= 10" |
| 155 | +``` |
| 156 | +
|
| 157 | +### Output Components |
| 158 | +
|
| 159 | +ArkFlow supports multiple output targets: |
| 160 | +
|
| 161 | +- **Kafka**: Write data to Kafka topics |
| 162 | +- **MQTT**: Publish messages to MQTT topics |
| 163 | +- **HTTP**: Send data via HTTP |
| 164 | +- **Standard Output**: Output data to the console |
| 165 | +- **Drop**: Discard data |
| 166 | +- **Nats**: Publish messages to Nats topics |
| 167 | +
|
| 168 | +Example: |
| 169 | +
|
| 170 | +```yaml |
| 171 | +output: |
| 172 | + type: kafka |
| 173 | + brokers: |
| 174 | + - localhost:9092 |
| 175 | + topic: |
| 176 | + type: value |
| 177 | + value: test-topic |
| 178 | + client_id: arkflow-producer |
| 179 | +``` |
| 180 | +### Error Output Components |
| 181 | +ArkFlow supports multiple error output targets: |
| 182 | +- **Kafka**: Write error data to Kafka topics |
| 183 | +- **MQTT**: Publish error messages to MQTT topics |
| 184 | +- **HTTP**: Send error data via HTTP |
| 185 | +- **Standard Output**: Output error data to the console |
| 186 | +- **Drop**: Discard error data |
| 187 | +- **Nats**: Publish messages to Nats topics |
| 188 | +
|
| 189 | +Example: |
| 190 | +
|
| 191 | +```yaml |
| 192 | +error_output: |
| 193 | + type: kafka |
| 194 | + brokers: |
| 195 | + - localhost:9092 |
| 196 | + topic: |
| 197 | + type: value |
| 198 | + value: error-topic |
| 199 | + client_id: error-arkflow-producer |
| 200 | +``` |
| 201 | +
|
| 202 | +
|
| 203 | +### Buffer Components |
| 204 | +
|
| 205 | +ArkFlow provides buffer capabilities to handle backpressure and temporary storage of messages: |
| 206 | +
|
| 207 | +- **Memory Buffer**: Memory buffer, for high-throughput scenarios and window aggregation. |
| 208 | +- **Session Window**: The Session Window buffer component provides a session-based message grouping mechanism where messages are grouped based on activity gaps. It implements a session window that closes after a configurable period of inactivity. |
| 209 | +- **Sliding Window**: The Sliding Window buffer component provides a time-based windowing mechanism for processing message batches. It implements a sliding window algorithm with configurable window size, slide interval and slide size. |
| 210 | +- **Tumbling Window**: The Tumbling Window buffer component provides a fixed-size, non-overlapping windowing mechanism for processing message batches. It implements a tumbling window algorithm with configurable interval settings. |
| 211 | +
|
| 212 | +Example: |
| 213 | +
|
| 214 | +```yaml |
| 215 | +buffer: |
| 216 | + type: memory |
| 217 | + capacity: 10000 # Maximum number of messages to buffer |
| 218 | + timeout: 10s # Maximum time to buffer messages |
| 219 | +``` |
0 commit comments