#task #command #runner #cmd #build #failure #output #echo #onqueue

app onqueue

a lightweight, multithreaded task queue runner

1 unstable release

Uses new Rust 2024

new 0.1.0 Apr 25, 2025

#8 in #echo

MIT license

14KB
174 lines

Onqueue

Stars Badge Forks Badge Issues Badge License Badge

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.


๐Ÿ“ฆ Features

  • โœ… Queue tasks with names and commands
  • โœ… Web server using Axum with endpoints to add/list tasks
  • โœ… CLI support: onqueue add, onqueue list
  • โœ… Multithreaded task runner with retry support
  • โœ… Persistent queue file via queue.yml
  • โœ… JSON API output
  • โœ… Automatic retries on failure
  • โœ… Configurable apps via queue-app.yml

๐Ÿงฐ Usage

โ–ถ๏ธ Running the Server

onqueue serve

Server starts on http://localhost:8080


๐ŸŒ API Endpoints

  • GET / โ€“ Show welcome message
  • GET /list โ€“ Return current tasks as JSON
  • GET /add?name=app1&cmd=echo+Hello โ€“ Queue a new task

๐Ÿ–ฅ๏ธ CLI Usage

Add from queue-app.yml

# queue-app.yml
name: deploy
command: ansible-playbook deploy.yml
onqueue add .

List tasks

onqueue list

๐Ÿ“‚ Directory Structure

.
โ”œโ”€โ”€ src/
โ”œโ”€โ”€ queue.yml           # Stores all queued tasks
โ”œโ”€โ”€ queue-app.yml       # CLI-based task configuration
โ”œโ”€โ”€ logs/               # (planned) Directory for task execution logs
โ”œโ”€โ”€ Cargo.toml
โ””โ”€โ”€ README.md

๐Ÿ“– Example

curl "http://localhost:8080/add?name=build&cmd=echo+Building"
curl "http://localhost:8080/list"

Output:

[
  {
    "name": "build",
    "command": "echo Building",
    "status": "completed",
    "start_time": "2025-04-07T10:00:00Z",
    "end_time": "2025-04-07T10:00:01Z",
    "retries": 0
  }
]

๐Ÿ›ฃ Roadmap

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

  • Logging
  • CLI formatting
  • Cron-like scheduling
  • Persistent task results
  • PM2 integration

๐Ÿงช Development

Install dependencies:

cargo install --path .

Run in dev mode:

cargo run

โš–๏ธ License

MIT ยฉ [Your Name or Org]

Dependencies

~10โ€“18MB
~241K SLoC