Qrusty 🦀
The trusty priority queue server that never forgets
Qrusty is a high-performance priority queue server written in Rust, designed for reliable message processing with filesystem persistence and acknowledgment support.
Features
- 🚀 Fast - 50,000+ messages/second
- 💾 Persistent - Survives restarts with RocksDB storage (or run in-memory)
- 🎯 Priority-based - Numeric (u64) or text (lexicographic string) priorities
- ⚡ Configurable Ordering - Min-first or max-first priority queues
- ✅ Acknowledgments - Messages requeue on timeout
- 🔄 Multiple queues - Run dozens of isolated queues
- 🌐 Simple HTTP API - Easy integration with any language
- 🐳 Docker-ready - Single container deployment
Priority Ordering
Qrusty supports two priority ordering modes that can be configured per queue:
Max-First (Default)
- Higher priority values are processed first
- Priority 100 comes before priority 50
- Traditional "high priority = urgent" model
- Perfect for urgent/critical task processing
Min-First
- Lower priority values are processed first
- Priority 10 comes before priority 50
- Unix process priority model (lower = higher priority)
- Ideal for batch processing and background jobs
Priority Kinds
Each queue is configured with a priority_kind that determines which type of priority values it accepts:
- Numeric (default) — unsigned 64-bit integers (0 to 2^64-1)
- Text — arbitrary UTF-8 strings for lexicographic ordering
# Create a queue with text priorities
# Publish with a string priority
Quick Start
Create Queues with Different Orderings
# Create a max-first queue for urgent tasks
# Create a min-first queue for batch processing
Publish Messages
# Publish to urgent queue (high priority = 100)
# Publish to batch queue (low priority = 10)
Consume Messages
# Consume from urgent queue (gets highest priority first)
# Consume from batch queue (gets lowest priority first)
Queue Management
# Get queue statistics
# Update queue configuration (change allow_duplicates)
# Rename a queue and update allow_duplicates
# Purge all messages from a queue (preserves configuration)
# Delete a queue and all its messages
API Endpoints
POST /create-queue- Create a new queue with specific configurationPOST /update-queue- Update queue name and/or allow_duplicates setting (queue type is immutable)POST /publish- Publish a message to a queuePOST /consume/{queue}- Consume a message from a queuePOST /ack/{queue}/{id}- Acknowledge a messagePOST /nack/{queue}/{id}- Negative acknowledge (requeue)GET /stats- Get queue statisticsPOST /purge-queue/{queue}- Remove all messages (keep configuration)DELETE /delete-queue/{queue}- Delete queue and all messagesGET /health- Health check endpoint
Examples and Integration
For comprehensive examples and integration guides, see:
- Queue Management Guide - Complete cURL, Python, and JavaScript examples
- Python Integration Examples - Production-ready Python integration
- Node-RED Integration - For IoT and workflow automation
- Priority Usage Examples - Understanding priority ordering
- API Usage Examples - Comprehensive API documentation
Example consume with a longer timeout:
Make Targets
Run these from the dev container, or an equivalent environment:
make all- Build, generate docs, run machete, and testmake build- Build the Rust project with cargomake doc- Generate documentation with cargo docmake machete- Run cargo machete (dependency analysis)make test- Run tests with cargo testmake smoke-test- Run the live end-to-end smoke test (see below)make smoke-test-memory- Same smoke test using in-memory storagemake traceability- Print traceability report to stdoutmake traceability-report- Save traceability report todocs/traceability_report.md
Live Smoke Test
make smoke-test builds the binary, starts a real qrusty server on an
isolated port, runs concurrent publishers and consumers against three queues
for 30 seconds, polls /stats every 3 seconds to display a live throughput
table, and asserts that publish_rate_per_sec and ack_rate_per_sec are
non-zero — proving the server actually processes messages and reports accurate
statistics.
# Default run (30 s workload, port 17784)
# Longer run on a custom port
# Point at a release build
Requirements: SYS-0011, SYS-0012
Coverage targets (requires cargo llvm-cov in your environment):
make coverage- Run the full Rust test suite with coverage and print a summarymake coverage-missing- Generatetarget/llvm-cov/missing.txtwith uncovered line numbersmake coverage-summary-json- Generatetarget/llvm-cov/summary.json(machine-readable totals)make coverage-html- Generate an HTML report attarget/llvm-cov/html/index.htmlmake coverage-clean- Remove coverage artifacts generated bycargo llvm-cov
Run this outside the dev container, unless it's been altered to allow docker-in-docker:
make show-docs- Build and open the docs in the default browsermake build-qrusty- Build and push Docker image for ARM64 platform
Requirements (Doorstop)
This repo uses Doorstop for Requirements-Based Verification (RBV).
Document hierarchy
| Document | Prefix | Parent | Purpose |
|---|---|---|---|
requirements/system/ |
SYS | (root) | System-level requirements (deployment, health, web UI) |
requirements/persistence/ |
PER | SYS | Persistence and recovery |
requirements/scheduling/ |
SCH | SYS | Priority and scheduling |
requirements/delivery/ |
DLV | SYS | Delivery semantics (lock, ack, nack, retry) |
requirements/api/ |
API | SYS | HTTP API endpoints |
requirements/websocket/ |
WS | SYS | WebSocket API |
Each requirement YAML item includes:
- text – "The system shall …" requirement statement.
- verification – IADT method:
inspection,analysis,demonstration, ortest. - links – parent requirement UIDs (for traceability).
Run Doorstop in the dev container
The devcontainer includes a helper script that bootstraps a local venv at .venv/ (if missing), installs Doorstop, and starts doorstop-server:
Then open:
To stop the server:
||
Traceability
Requirements are linked to implementation code and tests via special comment tags:
Implementation tagging (Rust doc comments):
/// Requirements: PER-0001, PER-0002, SCH-0001
pub async
Test tagging (Rust comments):
// Verifies: DLV-0001, DLV-0002, API-0003
async
Generate traceability report:
# Print to stdout
# Save to docs/traceability_report.md
The report shows:
- Which requirements have implementation and test coverage
- Untraced requirements (gaps in coverage)
- Orphan tags (tags referencing non-existent requirements)
- Detailed links to source locations
See docs/traceability_report.md for the current report.
In-Memory Storage Mode
Qrusty supports an optional in-memory storage backend (STORAGE_MODE=memory)
that eliminates all disk I/O. This is useful when persistent storage is
unavailable or unreliable (e.g. a failing drive).
All functional behaviour (priority ordering, locking, ACK/NACK, dead-letter queues, duplicate detection, timeout monitoring) is identical to RocksDB mode.
All data is lost on restart. A warning is logged at startup.
# Docker
# Cargo
STORAGE_MODE=memory
To switch back, remove STORAGE_MODE=memory (or set it to rocksdb) and
ensure a volume is mounted at /data.
Requirements: SYS-0013, PER-0011
Using the Docker Image
# Pull the image
# Run with default settings (RocksDB persistence)
# Run with custom data path and bind address
# Run with in-memory storage (no disk I/O)
# Build locally (from a prompt that can run docker)