Skip to content

Onqueue is a lightweight, multithreaded task queue runner built in Rust using Axum. It supports REST API and CLI-based task management, making it ideal for automating shell commands, deployment tasks, and lightweight job queues.

Notifications You must be signed in to change notification settings

marcuwynu23/onqueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Onqueue

Stars Badge Forks Badge Issues Badge License Badge

Onqueue is a lightweight, multithreaded task queue runner built in Rust. It features a socket-based client-server architecture for reliable task management, making it ideal for automating shell commands, deployment tasks, and lightweight job queues.


πŸ“¦ Features

  • βœ… Socket-based client-server architecture - Fast, reliable TCP communication
  • βœ… Task queue management - Queue, execute, and monitor tasks with names and commands
  • βœ… Full CLI client - Complete command-line interface for task management
  • βœ… Multithreaded task runner - Concurrent task execution with configurable intervals
  • βœ… Persistent queue state - Tasks saved to records.yml for reliability
  • βœ… Task lifecycle management - Add, list, status, retry, delete, and run tasks
  • βœ… Automatic retries - Built-in retry support for failed tasks
  • βœ… Service installation - Easy setup as system service on Windows, Linux, and macOS
  • βœ… Comprehensive testing - Full test suite with unit and integration tests
  • βœ… Cross-platform - Supports Windows, Linux, and macOS

πŸ—οΈ Architecture

Onqueue uses a client-server architecture with TCP socket communication:

  • Server (onqueued): Runs the task queue, executes tasks, and manages state
  • Client (onqueue): CLI tool to interact with the server

The server listens on TCP sockets (default: 0.0.0.0:9876) and processes JSON-based commands from clients.


πŸš€ Quick Start

Installation

Option 1: Service Installation (Recommended)

Windows:

# As Administrator
.\scripts\windows\install-service.ps1
Start-Service -Name OnqueueServer

Linux:

sudo ./scripts/linux/install-service.sh
sudo systemctl enable --now onqueued

macOS:

sudo ./scripts/macos/install-service.sh

See Installation Guide for detailed instructions.

Option 2: Manual Installation

  1. Build from source:

    cargo build --release
  2. Run the server:

    ./target/release/onqueued
    # Or on Windows: .\target\release\onqueued.exe
  3. Use the client:

    ./target/release/onqueue list

🧰 Usage

Running the Server

# Using default config (0.0.0.0:9876)
./onqueued

# Or with cargo
cargo run --bin onqueued

The server will:

  • Load configuration from config.yml (optional)
  • Listen on the configured address (default: 0.0.0.0:9876)
  • Process queued tasks at the configured interval (default: 10 seconds)
  • Save queue state to records.yml

Client Commands

List all tasks

onqueue list

Add a task

onqueue add --name "my-task" --cmd "echo hello world"

Get status

# Overall statistics
onqueue status

# Specific task status
onqueue status my-task

Retry a failed task

onqueue retry --name "my-task"

Delete a task

onqueue delete --name "my-task"

Run a task immediately

onqueue run --name "my-task"

Connect to remote server

onqueue --server 192.168.1.100:9876 list

πŸ“– Examples

Basic Task Management

# Start the server
./onqueued

# In another terminal, add a task
onqueue add --name "build" --cmd "cargo build --release"

# Check status
onqueue status build

# List all tasks
onqueue list

Task Lifecycle

# Add multiple tasks
onqueue add --name "task1" --cmd "echo 'Task 1'"
onqueue add --name "task2" --cmd "echo 'Task 2'"
onqueue add --name "task3" --cmd "echo 'Task 3'"

# Check overall status
onqueue status
# Output: {"total": 3, "queued": 2, "running": 0, "completed": 1, "failed": 0}

# Retry a failed task
onqueue retry --name "task1"

# Delete a completed task
onqueue delete --name "task2"

Configuration

Create config.yml:

host: "0.0.0.0"
port: 9876
task_interval: 10  # seconds between task checks
log_file: "logs/output.log"

πŸ“‚ Project Structure

onqueue/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ server.rs          # Server binary (onqueued)
β”‚   β”œβ”€β”€ client.rs          # Client binary (onqueue)
β”‚   β”œβ”€β”€ server_types.rs    # Shared server types
β”‚   └── client_types.rs    # Shared client types
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ windows/           # Windows service scripts
β”‚   β”œβ”€β”€ linux/             # Linux systemd scripts
β”‚   β”œβ”€β”€ macos/             # macOS launchd scripts
β”‚   └── README.md          # Installation guide
β”œβ”€β”€ tests/                 # Test suite
β”œβ”€β”€ config.yml.example     # Configuration template
β”œβ”€β”€ records.yml.example     # Queue records template
β”œβ”€β”€ Cargo.toml
└── README.md

πŸ”§ Configuration

The server can be configured via config.yml:

Option Default Description
host 0.0.0.0 Server bind address
port 9876 Server port
task_interval 10 Seconds between task checks
log_file logs/output.log Log file path

πŸ§ͺ Testing

Run the test suite:

# Run all unit tests
cargo test

# Run specific test suite
cargo test --test server_queue_tests
cargo test --test server_protocol_tests
cargo test --test client_tests

# Run integration tests (requires running server)
cargo test --test integration_tests -- --ignored

See Tests README for more details.


πŸ“š Documentation


πŸ›£οΈ Roadmap

See FEATURE-TODO-LIST.md for upcoming improvements:

  • Structured logging with tracing
  • Web dashboard UI
  • Docker support
  • Task scheduling (cron-like)
  • Authentication and security
  • Task tagging and filtering

πŸ§ͺ Development

Prerequisites

  • Rust 1.70+ (stable)
  • Cargo

Building

# Build release binaries
cargo build --release

# Build specific binary
cargo build --release --bin onqueued
cargo build --release --bin onqueue

Running in Development

# Run server
cargo run --bin onqueued

# Run client
cargo run --bin onqueue -- list

Running Tests

# All tests
cargo test

# With output
cargo test -- --nocapture

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


βš–οΈ License

MIT Β© Mark Wayne Menorca


πŸ™ Acknowledgments

Built with:

About

Onqueue is a lightweight, multithreaded task queue runner built in Rust using Axum. It supports REST API and CLI-based task management, making it ideal for automating shell commands, deployment tasks, and lightweight job queues.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published