Hammerwork
A high-performance, database-driven job queue for Rust with comprehensive features for production workloads.
Features
- Multi-database support: PostgreSQL and MySQL backends
- Job prioritization: Five priority levels with weighted and strict scheduling algorithms
- Batch operations: High-performance bulk job enqueuing with optimized worker processing
- Cron scheduling: Full cron expression support with timezone awareness
- Rate limiting: Token bucket rate limiting with configurable burst limits
- Monitoring: Prometheus metrics and advanced alerting (enabled by default)
- Job timeouts: Per-job and worker-level timeout configuration
- Statistics: Comprehensive job statistics and dead job management
- Async/await: Built on Tokio for high concurrency
- Type-safe: Leverages Rust's type system for reliability
Installation
[]
# Default features include metrics and alerting
= { = "0.7", = ["postgres"] }
# or
= { = "0.7", = ["mysql"] }
# Minimal installation
= { = "0.7", = ["postgres"], = false }
Feature Flags: postgres, mysql, metrics (default), alerting (default)
Quick Start
See the Quick Start Guide for complete examples with PostgreSQL and MySQL.
Documentation
- Quick Start Guide - Get started with PostgreSQL and MySQL
- Job Types & Configuration - Job creation, priorities, timeouts, cron jobs
- Worker Configuration - Worker setup, rate limiting, statistics
- Cron Scheduling - Recurring jobs with timezone support
- Priority System - Five-level priority system with weighted scheduling
- Batch Operations - High-performance bulk job processing
- Monitoring & Alerting - Prometheus metrics and notification systems
Basic Example
use ;
use json;
use Arc;
async
Database Schema
Hammerwork uses a single hammerwork_jobs table with optimized indexes for performance. The schema supports all features including priorities, timeouts, cron scheduling, and comprehensive job lifecycle tracking.
Development
Comprehensive testing with Docker containers:
# Start databases and run all tests
# Run specific database tests
See docs/integration-testing.md for complete development setup.
Examples
Working examples in examples/:
postgres_example.rs- PostgreSQL with timeouts and statisticsmysql_example.rs- MySQL with workers and prioritiescron_example.rs- Cron scheduling with timezonespriority_example.rs- Priority system demonstrationbatch_example.rs- Bulk job enqueuing and processingworker_batch_example.rs- Worker batch processing features
Contributing
- Fork the repository and create a feature branch
- Run tests:
make integration-all - Ensure code follows Rust standards (
cargo fmt,cargo clippy) - Submit a pull request with tests and documentation
License
This project is licensed under the MIT License - see the LICENSE-MIT file for details.