asyioflow-engine

Distributed task & workflow orchestration engine — the core of the AysioFlow ecosystem.
Submit jobs, define multi-step workflows as DAGs, track status in real time, and monitor with Prometheus. Exposes both REST and gRPC APIs.
Architecture
┌─────────────┐ REST :8080 ┌──────────────────────────────────┐
│ Clients │ ──────────────────► │ │
│ (SDK/CLI) │ gRPC :9090 │ asyioflow-engine │
│ │ ──────────────────► │ │
└─────────────┘ │ ┌──────────┐ ┌─────────────┐ │
│ │ Engine │──►│ Redis Queue │ │
│ │ Core │ └─────────────┘ │
│ │ │ ┌─────────────┐ │
│ │ │──►│ PostgreSQL │ │
│ └──────────┘ └─────────────┘ │
└──────────────────────────────────┘
| Component |
Tech |
Purpose |
| Engine |
Go |
Job lifecycle, retry logic, DLQ |
| Queue |
Redis (Sorted Sets) |
Priority-aware job queue |
| Store |
PostgreSQL |
Persistent job state |
| REST API |
Chi |
HTTP interface |
| gRPC API |
protobuf |
Low-latency CLI/SDK interface |
| Metrics |
Prometheus |
Observability |
Quickstart
Prerequisites: Docker & docker-compose
# 1. Clone and start
git clone https://github.com/mohashari/asyioflow-engine
cd engine
docker-compose -f deployments/docker-compose.yml up -d
# 2. Apply migrations
docker exec -i $(docker-compose -f deployments/docker-compose.yml ps -q postgres) \
psql -U asyioflow asyioflow < migrations/001_create_jobs.sql
# 3. Submit a job
curl -X POST http://localhost:8080/api/v1/jobs \
-H "Content-Type: application/json" \
-d '{"type":"send-email","payload":{"to":"hello@example.com"}}'
# → {"id":"...","status":"queued",...}
# 4. Check status
curl http://localhost:8080/api/v1/jobs/<id>
# 5. Cancel a job
curl -X DELETE http://localhost:8080/api/v1/jobs/<id>
API Reference
| Method |
Endpoint |
Description |
POST |
/api/v1/jobs |
Submit a job |
GET |
/api/v1/jobs/:id |
Get job status |
DELETE |
/api/v1/jobs/:id |
Cancel a job |
GET |
/metrics |
Prometheus metrics |
Full spec: api/openapi.yaml
Submit job request:
{
"type": "send-email",
"payload": { "to": "user@example.com" },
"priority": 10,
"max_retries": 3
}
Job status values: pending → queued → running → completed | failed → queued (retry) | dead
Development
# Run unit tests
go test ./internal/domain/... ./internal/metrics/... -v
# Run all tests (requires Docker)
go test ./... -v -timeout 120s
# Build binary
make build
# Start local infrastructure
make docker-up
Environment variables:
| Variable |
Default |
Description |
PORT |
8080 |
HTTP server port |
GRPC_PORT |
9090 |
gRPC server port |
REDIS_ADDR |
localhost:6379 |
Redis address |
DATABASE_URL |
postgres://asyioflow:secret@localhost:5432/asyioflow?sslmode=disable |
PostgreSQL DSN |
Ecosystem
This is one of five repositories in the AysioFlow ecosystem:
License
MIT