JSPM

pg-boss

0.1.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 217067
  • Score
    100M100P100Q171982F
  • License MIT

Queueing jobs in Node.js using PostgreSQL like a boss

Package Exports

  • pg-boss

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pg-boss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Queueing jobs in Node.js using PostgreSQL like a boss.

npm version Build Status Coverage Status Dependencies PostgreSql Version

var PgBoss = require('pg-boss');
var boss = new PgBoss('postgres://username:password@localhost/database');

boss.on('error', error => console.error(error));
boss.on('ready', ready);

boss.start();

function ready() {
    boss.publish('work', {message: 'stuff'})
        .then(jobId => console.log(`created job ${jobId}`));

    boss.subscribe('work', (job, done) => {
        console.log(`received job ${job.name}, ID ${job.id}, payload ${JSON.stringify(job.data)}`);

        done().then(() => console.log('Confirmed done'));
    });
}

##Installation $ npm install pg-boss

##Features

  • Guaranteed delivery and finalizing of jobs using a promise API
  • Delayed jobs
  • Distributed and/or clustered workers
  • Job throttling (rate limiting)
  • Automatic provisioning of required storage into an dedicated schema
  • Automatic monitoring for expired jobs
  • Automatic archiving for completed jobs

##Requirements

  • Node 0.10 or higher (It may work on older versions, but who's using < 0.10? :)
  • Postgres 9.5 or higher (see background below for rationale)

##Background pg-boss was created to leverage recent additions in PostreSQL 9.5 (specifically SKIP LOCKED and upserts) which significantly enhances it's ability to act as a reliable, distributed message queue.