@portqueue/core
v1.3.0
Published
A horizontally scalable, fault-tolerant, database-agnostic, performance-focused queue implementation.
Maintainers
Readme
@portqueue/core
The engine and first-party drivers for PortQueue — a horizontally scalable, fault-tolerant, database-agnostic, performance-focused queue implementation, running on your own database (PostgreSQL, MySQL, Oracle, PGLite, SQLite, Turso) through one API.
npm install @portqueue/core
# + the client for your DB, e.g. one of:
npm install pg # PostgreSQL
npm install mysql2 # MySQL
npm install oracledb # Oracle
npm install @electric-sql/pglite # PGLite (embedded/edge/tests)
npm install better-sqlite3 # SQLite
npm install @tursodatabase/serverless # Turso Cloud
npm install @tursodatabase/database # Turso, local (embedded, no server)import { PortQueue } from '@portqueue/core';
import { PostgresqlDriver } from '@portqueue/core/drivers/postgresql';
const pq = new PortQueue({
driver: new PostgresqlDriver({ connection: { connectionString: process.env.DATABASE_URL } }),
});
await pq.init();
// Create the queue and provide a jobs handler.
pq.createQueue({
name: 'reports',
limiter: { concurrency: 10 },
handler: async (job) => { await buildReport(job.data); },
});
// Add a job to the queue.
await pq.addJob({ queue: 'reports', data: { kind: 'sales' } });Free and open source. Commercial use permitted. No license fee, no obligations. (MIT)
- Subpath driver imports:
@portqueue/core/drivers/{postgresql,mysql,oracle,pglite,sqlite,turso}. Each driver takes either a client you already own (pool/database/client) orconnection: the client library's own option type (pg.PoolConfig,oracledb'sPoolAttributes,PGliteOptions,better-sqlite3'sOptions,mysql2'sPoolOptions,@tursodatabase/serverless'sConfigor@tursodatabase/database's options). - Transaction adapters:
@portqueue/core/tx(fromKnex,fromPg, …) - Custom-driver conformance kit:
@portqueue/core/conformance
See the documentation for the full API.
