1.0.1 • Published 1 year ago

@roonlabs/node-pg-tasks v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

node-pg-tasks

Pub/Sub task queue backed by Postgres

Quickstart

const PgTasks = require('@roonlabs/node-pg-tasks');
const client  = new PgTasks({user: 'postgres', password: 'postgres', database: 'testdb'})

client.subscribe(t => {
    console.log('Received task', t);
    t.ack();
});

(async function() {
    try {
        await client.connect();
        while (true) {
            await new Promise(r => setTimeout(r, 1000));
            await client.publish({ type: 'test', foo: 1 });
        }
    } catch (e) {
        console.log(e);
    }
})()
1.0.1

1 year ago

1.0.0

1 year ago