Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/msolli/proletarian/llms.txt

Use this file to discover all available pages before exploring further.

Proletarian is a battle-tested background job library for Clojure applications. It uses your existing PostgreSQL or MySQL database as the job queue, giving you durable, transactional job processing without introducing new infrastructure. Jobs survive application restarts, and transactional enqueueing lets you atomically commit business logic alongside job creation.

Installation

Add Proletarian to your deps.edn or project.clj and set up the database tables.

Quickstart

Create your first queue worker and enqueue a job in minutes.

Core Concepts

Understand queue workers, job handlers, and at-least-once processing.

API Reference

Full reference for enqueue!, create-queue-worker, and all public functions.

Why Proletarian?

Most background job systems require you to run a separate message broker (Redis, RabbitMQ, etc.). If you’re already on PostgreSQL or MySQL, Proletarian lets you skip that extra dependency entirely — your job queue lives right alongside your application data.

Transactional Enqueueing

Enqueue jobs inside a database transaction alongside your business logic writes. Either both succeed or both roll back — no orphaned jobs, no missed notifications.

At-Least-Once Delivery

Jobs are never removed from the queue until they complete successfully. Workers use SELECT ... FOR UPDATE SKIP LOCKED for safe concurrent processing.

Configurable Retries

Define per-job retry counts and delays. Inspect the exception to make smart retry decisions, such as reading Retry-After headers from external APIs.

Multiple Queues

Create multiple named queues with independent thread pools and polling intervals to prioritize different workloads.

Get Started in Three Steps

1

Add the dependency

Add msolli/proletarian {:mvn/version "1.0.115"} to your deps.edn.
2

Create the database tables

Run the provided SQL migration for PostgreSQL or MySQL to create the proletarian.job and proletarian.archived_job tables.
3

Create a worker and enqueue jobs

Call worker/create-queue-worker with your data source and handler function, start it with worker/start!, and enqueue jobs with job/enqueue!.

Explore the Docs

Database Setup

PostgreSQL and MySQL table definitions and installation scripts.

Retries & Failures

Configure retry strategies and handle permanently failed jobs.

Graceful Shutdown

Handle JVM shutdown hooks and thread interrupts correctly.

Logging

Integrate Proletarian’s event log with your application’s logger.

Scheduled Jobs

Delay job execution with process-at and process-in options.

Examples

Runnable examples covering basics, retries, and shutdown handling.

Build docs developers (and LLMs) love