A simple yet powerful PostgreSQL-backed job queue for Node.js (version 4.4.2). It provides persistent job creation, scheduled processing, and immediate processing with locking. Unlike alternative libraries (e.g., Kue, Bull) that require Redis, pg-jobs leverages PostgreSQL for storage and atomic operations, making it ideal for projects already using PostgreSQL. The library has a low release cadence but is stable for production use. Key features: job scheduling with delays, concurrent worker support, and automatic table creation via migrations.
npm install pg-jobsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a new job with a delay, defining a worker function with done callback, and starting the processing loop.
Update Node.js to >=10 and pg to >=8.
Use 0 for immediate processing or omit/use null only if you don't want retries.
Use process managers (e.g., cluster) to run multiple worker processes.
Replace jobs.stopProcessing() with jobs.stop() in your code.
Ensure PostgreSQL is running and DATABASE_URL is correct.
Call jobQueue(options) first: const jobs = jobQueue(options); then jobs.create(...).
Run migrations: db-migrate up -m node_modules/pg-jobs/migrations/ --config database.json