Registry / database / better-queue-sql

better-queue-sql

JSON →
library1.0.6jsnpmunverified

A SQL-based store plugin for the better-queue library, enabling persistent queue storage in relational databases. Version 1.0.6 is the latest stable release, though the project appears unmaintained since 2016. It integrates with better-queue's store interface to replace the default in-memory store with SQL backends, allowing queues to survive process restarts. Compared to memory-only stores, it adds durability but requires careful schema management and connection pooling.

npm install better-queue-sql
INSTALL
IMPORT
SIG · BETTER-QUEUE-SQL
B
better-queue-sql
databasejavascriptv1.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SQLStore
var SQLStore = require('better-queue-sql');
import SQLStore from 'better-queue-sql';
Package is CommonJS-only; ESM import is not supported.
Queue
var Queue = require('better-queue');
var Queue = require('better-queue-sql');
Queue comes from better-queue, not this package.
store option
var q = new Queue(fn, { store: { type: 'sql', ... } });
var q = new Queue(fn, { store: new SQLStore(opts) });
Both patterns work; the inline type is simpler for basic use.

Shows how to create a SQLite-backed queue using better-queue-sql.

var Queue = require('better-queue'); var SQLStore = require('better-queue-sql'); var store = new SQLStore({ client: 'sqlite3', connection: { filename: './queue.db' }, tableName: 'my_queue' }); var q = new Queue(function (input, cb) { // process task console.log('Processing:', input); cb(null, 'done'); }, { store: store }); q.push({ task: 1 }); q.push({ task: 2 });
Debug
Known issues
breakingPackage requires better-queue@3.x peer dep; incompatible with v4+.
fix
Use better-queue@3.x or switch to a maintained store.
affects: >=1.0.0
deprecatedPackage last updated 2016; no ESM support, no TypeScript types.
fix
Consider using an alternative like @datastructures-js/queue or a modern store.
affects: >=1.0.0
gotchaSQLStore expects a knex instance or config object; incorrect config causes silent fails.
fix
Pass either a knex instance or a config object with `client` and `connection`.
affects: >=1.0.0
gotchaTable must be created manually or via knex migrations; store does not auto-create.
fix
Run CREATE TABLE IF NOT EXISTS with columns id, queue_name, priority, attempts, data, etc.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'better-queue'
Missing peer dependency better-queue.
fix
npm install better-queue@3 --save
Error: knex: Unknown database type 'mysql2'
Invalid client name in connection config.
fix
Use 'mysql', 'pg', 'sqlite3' etc. as per knex docs.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
better-queuerequiredPeer dep — runtime functionality requires better-queue's store API
Agent activity
14 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
better-queue-sql — npm install better-queue-sql · libregistry