GopherQueue
β¨ Features
| Feature |
Description |
| πΎ Durable Storage |
BoltDB-backed persistence β jobs survive crashes and restarts |
| β‘ Priority Queues |
Critical, High, Normal, Low, and Bulk priority levels |
| π Smart Retries |
Exponential, linear, or constant backoff strategies |
| π Observability |
Prometheus metrics, structured logging, health checks |
| π‘οΈ Fault Tolerant |
Panic recovery, checkpointing, graceful shutdown |
| π Security Ready |
API key auth, role-based authorization |
| π Job Dependencies |
Chain jobs with wait conditions |
| π Idempotency |
Built-in deduplication via idempotency keys |
π Quick Start
Install
go install github.com/sa001gar/gopherqueue/cmd/gq@latest
Start Server
gq serve # Default: 10 workers, port 8080
gq serve --http :8080 --workers 20 --data-dir ./data # Custom config
π³ Docker
docker run -d --name gopherqueue -p 8080:8080 -v gq_data:/data sa001gar/gopherqueue:latest
Submit a Job
# CLI
gq submit --type email --payload '{"to": "user@example.com"}'
# HTTP API
curl -X POST http://localhost:8080/api/v1/jobs \
-H "Content-Type: application/json" \
-d '{"type": "email", "payload": {"to": "user@example.com"}, "priority": 1}'
π¦ Multi-Language SDKs
Use GopherQueue from any language with our official SDKs.
π Python
pip install gopherqueue
from gopherqueue import GopherQueueSync
queue = GopherQueueSync("http://localhost:8080")
job = queue.submit("email", {"to": "user@example.com"})
print(f"Job {job.id} queued!")
|
π TypeScript / JavaScript
npm install gopherqueue
import { GopherQueue } from "gopherqueue";
const queue = new GopherQueue("http://localhost:8080");
const job = await queue.submit("email", { to: "user@example.com" });
console.log(`Job ${job.id} queued!`);
|
π Job Lifecycle
βββββββββββββββ
β completed β
βββββββββββββββ
β²
β success
βββββββββββ βββββββββββββ βββββββββββ΄ββββ
β pending βββββΆβ scheduled βββββΆβ running β
βββββββββββ βββββββββββββ ββββββββ¬βββββββ
β failure
ββββββββββββββββββββ΄βββββββββββββββββββ
βΌ βΌ
ββββββββββββββ ββββββββββββ
β retrying β β failed β
ββββββββββββββ βββββββ¬βββββ
β
βΌ
βββββββββββββββ
β dead_letter β
βββββββββββββββ
| State |
Description |
pending |
Created, waiting to be scheduled |
scheduled |
In priority queue, ready for pickup |
running |
Worker actively processing |
completed |
Finished successfully |
retrying |
Failed, waiting for retry |
failed |
Exceeded max attempts |
dead_letter |
Permanently failed, needs manual intervention |
βοΈ Configuration
| Flag |
Default |
Description |
--http |
:8080 |
HTTP server address |
--workers |
10 |
Concurrent worker count |
--data-dir |
./data |
BoltDB storage directory |
--shutdown-timeout |
30s |
Graceful shutdown timeout |
Priority Levels
| Priority |
Value |
Use Case |
| Critical |
0 |
System alerts, payments |
| High |
1 |
User-initiated actions |
| Normal |
2 |
Standard background work |
| Low |
3 |
Batch processing |
| Bulk |
4 |
Data migrations |
π Documentation
| Guide |
Description |
| π SDK Guide |
Complete SDK reference with framework examples |
| π Deployment |
Self-hosting, Docker, Kubernetes |
| π API Spec |
REST API documentation |
| ποΈ Architecture |
System design & internals |
| π Security |
Auth, authorization, best practices |
| π Observability |
Metrics, logging, monitoring |
Framework Guides
ποΈ Project Structure
gopherqueue/
βββ api/ # HTTP API handlers
βββ cli/ # Command-line interface
βββ cmd/gq/ # Main entry point
βββ core/ # Core types & options
βββ docs/ # Documentation
βββ observability/ # Metrics & health
βββ persistence/ # Storage (BoltDB)
βββ scheduler/ # Priority queue
βββ sdks/ # Python & TypeScript SDKs
βββ security/ # Auth & authorization
βββ worker/ # Job execution
π€ Contributing
Contributions welcome! Please read our Contributing Guide.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
π License
MIT License β see LICENSE.