Header-only C++17 library

Distributed task queues for modern C++

Redis-backed, header-only task queue with worker orchestration, scheduling, automatic retries, and a complete tooling ecosystem. Drop one header, link two libraries, and start processing.

$ cp cppq.hpp /your/project/ && g++ -std=c++17 app.cpp -lhiredis -luuid -lpthread

Everything you need for async job processing

Production-ready primitives for building reliable distributed systems in C++.

At-Least-Once Delivery

Tasks are guaranteed to execute at least once with automatic retry tracking. Failed tasks are re-enqueued with configurable retry limits.

Scheduled Execution

Enqueue tasks for future execution with precise time-based scheduling using standard C++ chrono. Cron support planned.

Task Recovery

Crashed workers don't lose tasks. Recovery logic automatically returns stuck tasks to the pending queue after configurable timeouts.

Priority Queues

Multiple named queues with configurable priority weights. Workers poll higher-priority queues more frequently, ensuring critical tasks run first.

Header-Only

Drop a single cppq.hpp file into your project. No build system integration needed. Just include, link, and go.

Atomic Lua Scripts

All Redis operations use server-side Lua scripts for atomic, race-condition-free task state transitions. No data loss under concurrency.

Simple, expressive API

Get a distributed task queue running in under 30 lines of code.

Three steps to async processing

cppq's API is designed to feel natural in modern C++ codebases. Define a handler, enqueue tasks, and let the server do the rest.

  1. Define a handler — write a function that processes a task and optionally sets a result.
  2. Register & enqueue — bind the handler to a task type, connect to Redis, and push tasks onto named queues.
  3. Run the server — call runServer with queue priorities and the thread pool spins up automatically.
example.cpp
#include "cppq.hpp"

// Define your task handler
void HandleEmail(cppq::Task& task) {
  auto payload = json::parse(task.payload);
  // ... send the email ...
  task.result = "{\"sent\": true}";
}

int main() {
  // Register handler for task type
  cppq::registerHandler("email:deliver",
                       &HandleEmail);

  // Connect to Redis
  redisOptions opts = {0};
  REDIS_OPTIONS_SET_TCP(&opts,
                        "127.0.0.1", 6379);
  auto* c = redisConnectWithOptions(&opts);

  // Enqueue tasks on named queues
  cppq::Task t{"email:deliver", payload, 10};
  cppq::enqueue(c, t, "high");

  // Start the worker server
  cppq::runServer(opts, {
    {"low", 5},
    {"default", 10},
    {"high", 20}
  }, 1000);
}

How cppq works

A clean, pipeline-based architecture built on Redis primitives.

Producer

Enqueues Task objects

Redis

Lists, hashes, Lua scripts

Worker Pool

Thread pool + handlers

Result

Stored back in Redis

Complete tooling, out of the box

A library, a CLI, and a dashboard — everything ops teams need.

C++17

Core Library

Header-only queue library with task creation, enqueuing, scheduling, recovery, pause/unpause, and a built-in thread pool. One file, zero build system configuration.

$ cp cppq.hpp /your/project/
Python

CLI Tool

Inspect queues, view task states and stats, pause or resume processing, and dump task metadata for debugging. Built with Click and Rich for beautiful terminal output.

$ python3 main.py queues --format json
Next.js

Web Dashboard

Real-time monitoring dashboard with task inspection, queue controls, and statistics. Built with Next.js 15, React 19, and Tailwind CSS for a modern interface.

$ cd web && npm install && npm run dev

Up and running in minutes

Works on Linux, macOS, and any POSIX system with a C++17 compiler.

Debian / Ubuntu

$ sudo apt install g++ libhiredis-dev uuid-dev

Arch Linux

$ sudo pacman -S hiredis util-linux-libs

macOS (Homebrew)

$ brew install hiredis ossp-uuid

Start processing tasks today

One header. Two dependencies. Zero configuration. Join the developers building reliable async systems in C++.