Cloacina
Cloacina is a Rust library for building resilient task pipelines directly within your Rust applications, built by Colliery Software. Unlike standalone orchestration services, Cloacina embeds into your existing applications to manage complex multi-step workflows with automatic retry, state persistence, and dependency resolution.
Why "Cloacina"? Named after the Roman goddess of sewers and drainage systems, Cloacina reflects the library's purpose: efficiently moving data through processing pipelines, just as ancient Roman infrastructure managed the flow of sewage out of the city. (Don't read too much into it, apparently there aren't any deities of "plumbing"!)
Features
- Embedded Framework: Integrates directly into your Rust applications
- Resilient Execution: Automatic retries, failure recovery, and state persistence
- Type-Safe Workflows: Compile-time validation of task dependencies and data flow
- Database-Backed: Uses PostgreSQL or SQLite for reliable state management
- Multi-Tenant Ready: PostgreSQL schema-based isolation for complete tenant separation
- Async-First: Built on tokio for high-performance concurrent execution
- Content-Versioned: Automatic workflow versioning based on task code and structure
Installation
Add Cloacina to your Cargo.toml:
[]
# PostgreSQL backend (default)
= { = "0.1.0", = ["postgres"] }
# Or SQLite backend
# cloacina = { version = "0.1.0", features = ["sqlite"] }
= "0.1" # Required for async task definitions
= "0.2" # Required for task registration
= "1.0" # Required for context data serialization
Quick Start
Here's a simple example that demonstrates the basic usage:
use *;
// Define a simple task
async
// Create the workflow
let workflow = workflow! ;
// Initialize executor with database
let executor = new.await?;
// Execute the workflow
let result = executor.execute.await?;
Multi-Tenancy
Cloacina supports multi-tenant deployments with complete data isolation:
PostgreSQL Schema-Based Isolation
// Each tenant gets their own PostgreSQL schema
let tenant_a = with_schema.await?;
let tenant_b = with_schema.await?;
// Or using the builder pattern
let executor = builder
.database_url
.schema
.build
.await?;
SQLite File-Based Isolation
// Each tenant gets their own database file
let tenant_a = new.await?;
let tenant_b = new.await?;
Benefits:
- Zero collision risk - Impossible for tenants to access each other's data
- No query changes - All existing DAL code works unchanged
- Performance - No overhead from filtering every query
- Clean separation - Each tenant can even have different schema versions
Documentation
Complete Documentation & User Guide
Additional resources:
- API Reference (Rust docs)
- Examples
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.