postgres-job-queue
PostgreSQL-based job queue with priority scheduling, batch claiming, and progress tracking. Use when building job queues without external dependencies. Triggers on PostgreSQL job queue, background jobs, task queue, priority queue, SKIP LOCKED.
Why use this skill?
Implement a production-ready PostgreSQL-based job queue with priority, batch claiming, and progress tracking. Avoid external dependencies.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/wpank/postgres-job-queueWhat This Skill Does
The postgres-job-queue skill provides a robust and dependency-light job queue system implemented entirely within PostgreSQL. It's designed for scenarios where you need background task processing, reliable job execution, and sophisticated queue management without introducing external services like Redis or RabbitMQ. Key features include priority scheduling, allowing critical jobs to be processed first; batch claiming, enabling workers to efficiently pick up multiple jobs at once using SKIP LOCKED to prevent contention; and progress tracking, offering visibility into the status and advancement of long-running tasks. Jobs are designed to survive service restarts due to their persistent storage in the database. The skill includes a well-defined SQL schema for the jobs table and a PostgreSQL function (claim_job_batch) for workers to claim jobs, along with considerations for a Go implementation.
Installation
To install this skill, use the following command:
clawhub install openclaw/skills/skills/wpank/postgres-job-queue
This command will download and configure the necessary components for the postgres-job-queue skill within your OpenClaw environment.
Use Cases
This skill is ideal for a variety of background processing needs:
- Microservice Task Offloading: Offload computationally intensive or time-consuming tasks from your main application services to background workers.
- Scheduled Reporting & Data Processing: Generate reports, perform data aggregations, or run batch updates on a schedule.
- Asynchronous Operations: Handle tasks like sending emails, processing images, or making external API calls without blocking the main application thread.
- Resilient Background Jobs: Ensure that jobs are not lost even if the application or worker instances crash and restart, thanks to PostgreSQL's transactional guarantees.
- Prioritized Workflows: Implement systems where certain jobs (e.g., critical user requests) must be processed before others (e.g., routine cleanup tasks).
Example Prompts
- "Set up a PostgreSQL job queue for processing image uploads, ensuring high priority for user-submitted images."
- "Create a worker that claims up to 5 jobs of type 'report_generation' from the PostgreSQL queue and updates their progress."
- "Monitor the PostgreSQL job queue for jobs that have been 'claimed' for more than 10 minutes and have not changed status."
Tips & Limitations
- PostgreSQL Resource Management: Ensure your PostgreSQL instance is adequately resourced, as the job queue operations will consume CPU, memory, and I/O. Monitor query performance, especially on the
jobstable. - Worker Implementation: You will need to implement worker processes (e.g., in Go, Python, or another language) that connect to your PostgreSQL database, call the
claim_job_batchfunction, process the claimed jobs, and update their status (e.g., 'completed', 'failed'). - Error Handling & Retries: The schema includes
attempts,max_attempts, andlast_errorfields. Implement logic in your workers to handle job failures, increment attempts, and potentially backoff or requeue failed jobs. - Progress Tracking Granularity: The
progressandcurrent_stagefields are simple indicators. For complex workflows, you might need more sophisticated event logging or a separate table to track detailed job progress. - Scalability: While
SKIP LOCKEDhelps with concurrent workers, the ultimate scalability is limited by your PostgreSQL instance's capacity and your worker implementation's efficiency. - Schema Evolution: Plan for potential schema migrations if your job requirements evolve over time.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-wpank-postgres-job-queue": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Related Skills
track-performance
Track the performance of Uniswap LP positions over time — check which positions need attention, are out of range, or have uncollected fees. Use when the user asks how their positions are doing.
ui-ux-pro-max
Searchable UI/UX design databases: 50+ styles, 97 palettes, 57 font pairings, 99 UX rules, 25 chart types. CLI generates design systems from natural language. Data-driven complement to ui-design.
web-design
CSS implementation patterns for layout, typography, color, spacing, and responsive design. Complements ui-design (fundamentals) with code-focused examples.
workflow-patterns
Systematic task implementation using TDD, phase checkpoints, and structured commits. Ensures quality through red-green-refactor cycles, 80% coverage gates, and verification protocols before proceeding.
websocket-hub-patterns
Horizontally-scalable WebSocket hub pattern with lazy Redis subscriptions, connection registry, and graceful shutdown. Use when building real-time WebSocket servers that scale across multiple instances. Triggers on WebSocket hub, WebSocket scaling, connection registry, Redis WebSocket, real-time gateway, horizontal scaling.