Actflow
Actflow is a lightweight, event-driven workflow engine written in Rust. It is designed to be embedded in your applications to orchestrate complex business logic with ease.
Features
- Event-Driven Architecture: Built on top of a robust event bus, ensuring high decoupling and scalability.
- Async Execution: Powered by
tokio, supporting high-concurrency workflow execution. - Pluggable Storage: Supports in-memory storage for testing and PostgreSQL for production persistence.
- Flexible Workflow Definition: Define workflows using JSON, supporting various node types and control flows.
- Automatic Process Management: Automatically manages the lifecycle of processes, including execution, suspension, and cleanup.
Supported Actions
| Action | Description |
|---|---|
start |
Entry point of the workflow |
http_request |
HTTP request with support for GET/POST/PUT/DELETE, authentication (Bearer/Basic/Custom), headers, params, and body |
if_else |
Conditional branching based on variable comparisons (equals, not_equals, contains, greater_than, etc.) |
code |
Execute JavaScript or Python code with variable inputs and JSON outputs |
Template Variables
Actflow supports template variables to reference outputs from other nodes:
{{#nodeId.key#}}
{{#nodeId.key.subkey#}}
Example: {{#n1.body.data.user.name#}} references the name field from node n1's output.
Quick Start
Here is a simple example of how to define and run a workflow:
use HashMap;
use ;
use json;
Architecture
Actflow consists of several core components:
- Engine: The entry point of the system, responsible for managing resources, loading workflows, and spawning processes.
- Channel: An internal event bus that broadcasts events (Workflow, Node, Log) to subscribers.
- Process: An instance of a running workflow. It maintains the execution context and state.
- Dispatcher: Responsible for scheduling node execution based on the workflow graph and current state.
- Store: Abstracted storage layer (Memory/Postgres) for persisting workflows, process states, and execution history.
Configuration
You can configure Actflow using the Config struct or a TOML file.
= 16
[]
= "postgres"
[]
= "postgres://user:pass@localhost:5432/actflow"