Registry / database / mysql-mq

mysql-mq

JSON →
library0.6.2jsnpmunverified

MySQL MQ is a lightweight message queue library backed by MySQL (v0.6.2). Designed for applications where a dedicated queue service like RabbitMQ or SQS is unavailable or overkill. Messages are stored in MySQL tables; queues are auto-created upon first use. Simple API with put, get, delete and a lock-based mechanism to prevent message duplication. The project follows semantic versioning and conventional commits, but has not seen updates since 2021 and remains unmaintained. Ideal for small-scale, single-database setups.

npm install mysql-mq
INSTALL
IMPORT
SIG · MYSQL-MQ
M
mysql-mq
databasejavascriptv0.6.2
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.

default
const mmq = require('mysql-mq');
import mmq from 'mysql-mq';
CommonJS only; no default ESM export.
Queue
new mmq('queueName', options);
const q = new Queue('name');
mmq is the constructor itself.
init
const queue = new mmq('name', opts); queue.init();
mmq.init();
init is an instance method.

Creates a queue, inserts a message, retrieves it, and deletes it.

const mmq = require('mysql-mq'); const queue = new mmq('my_queue', { host: 'localhost', port: 3306, user: 'root', password: process.env.MYSQL_PASSWORD ?? '', database: 'mydb' }); async function main() { await queue.init(); const id = await queue.put('Hello World'); console.log('Message ID:', id); const msg = await queue.get(); console.log('Received:', msg.message); await queue.delete(msg.id_message); console.log('Deleted'); } main().catch(console.error);
Debug
Known issues
gotchaQueue auto-creates on first use, but init() must be called explicitly to create table if you want early validation.
fix
Call queue.init() before any operations.
affects: >=0.0.0
deprecatedThe library uses deprecated mysql npm package; no built-in support for mysql2 or promise-based drivers.
fix
Consider wrapping calls in promises or using a different queue library.
affects: >=0.0.0
gotchaMessage IDs are not unique across queues; IDs are auto-increment per queue table.
fix
Always reference queue name with ID if using multiple queues.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'mysql'
mysql-mq depends on mysql but it's not installed.
fix
npm install mysql
Error: ER_BAD_DB_ERROR: Unknown database '...'
The specified database does not exist.
fix
Create the database before using mysql-mq.
TypeError: mmq is not a constructor
Using ESM import syntax with CommonJS module.
fix
Use require('mysql-mq') instead of import.
Upgrade
Version history
0.6.2latest on npm
Audit
Dependencies
mysqlrequiredRequired to connect to MySQL database
Agent activity
12 hits · last 30 days
node
10
Resources
mysql-mq — npm install mysql-mq · libregistry