Registry / messaging / lmdb-queue

lmdb-queue

JSON →
library0.2.0jsnpmunverified

lmdb-queue is a high-performance embedded queue library for Node.js, inspired by Kafka, capable of processing millions of messages per second. Current stable version is 0.2.0 (pre-1.0, may be unstable). Its core is implemented in C++ using LMDB, enabling multi-process access. It provides Producer and Consumer classes with configurable chunk size, batch size, and data types (string/buffer). Differentiators: embeddable, no external dependencies like Kafka, extremely high throughput. However, it has not been updated since 2015, lacks TypeScript support, and requires manual directory creation.

npm install lmdb-queue
INSTALL
IMPORT
SIG · LMDB-QUEUE
L
lmdb-queue
messagingjavascriptv0.2.0
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.

LmdbQueue
var LmdbQueue = require('lmdb-queue');
import LmdbQueue from 'lmdb-queue';
Package is CommonJS-only (CJS). ESM import will fail. Use require() or dynamic import().
Producer
var Producer = require('lmdb-queue').Producer;
var { Producer } = require('lmdb-queue');
Destructuring is fine, but common mistake is using default export. Producer is a property of the main export.
Consumer
var Consumer = require('lmdb-queue').Consumer;
new require('lmdb-queue').Consumer(...)
Instantiate with new. Ensure path exists before creating Consumer/Producer.
STRING_TYPE
LmdbQueue.STRING_TYPE
STRING_TYPE
DataType constants are properties of the main module export, not standalone exports.
BUFFER_TYPE
LmdbQueue.BUFFER_TYPE
require('lmdb-queue').BUFFER_TYPE
Access via LmdbQueue object after require.

Demonstrates creating a producer, pushing messages, creating a consumer, and popping messages in a loop.

const path = require('path'); const LmdbQueue = require('lmdb-queue'); const queuePath = path.join(__dirname, 'test-data'); const fs = require('fs'); if (!fs.existsSync(queuePath)) fs.mkdirSync(queuePath); const producer = new LmdbQueue.Producer({ path: queuePath, topic: 'test', dataType: LmdbQueue.STRING_TYPE, chunkSize: 64 * 1024 * 1024, chunksToKeep: 8 }); producer.push(['message1', 'message2']); const consumer = new LmdbQueue.Consumer({ path: queuePath, topic: 'test', name: 'test-consumer', dataType: LmdbQueue.STRING_TYPE, chunkSize: 64 * 1024 * 1024, batchSize: 1024 * 16 }); let msg; while (msg = consumer.pop()) { console.log('Received:', msg); }
Debug
Known issues
deprecatedPackage has not been updated since 2015 and uses nan for native bindings.
fix
Consider alternatives like bull, kue, or p-queue for maintained queue solutions.
affects: >=0.0.0
gotchaYou must create the directory specified by 'path' before creating a Producer or Consumer.
fix
Use fs.mkdirSync() or similar to ensure the directory exists.
affects: >=0.0.0
gotchaConsumer.pop() returns null when queue is empty, not undefined or throws.
fix
Check strictly!== null when looping.
affects: >=0.0.0
breakingVersion 0.2.0 changed the constructor options (e.g., 'batchSize' was added for Consumer).
fix
Refer to v0.2.0 documentation; older options may differ.
affects: >=0.2.0
gotchaThe package is Node.js only and may not work with Electron or other non-standard Node runtimes.
fix
Test in your target runtime; native binding may fail.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'lmdb-queue'
Package not installed or not resolved correctly.
fix
Run 'npm install lmdb-queue' in your project directory.
Error: ENOENT: no such file or directory, open '...'
The queue directory specified in options.path does not exist.
fix
Create the directory manually or with fs.mkdirSync before instantiating Producer/Consumer.
Error: Invalid dataType. Use LmdbQueue.STRING_TYPE or LmdbQueue.BUFFER_TYPE
Passed an incorrect dataType value.
fix
Use LmdbQueue.STRING_TYPE (0) or LmdbQueue.BUFFER_TYPE (1) from the main module export.
Error: The native module 'lmdb-queue' could not be loaded. Make sure it is compiled for your Node version.
Native addon built for a different Node.js ABI.
fix
Recompile: npm rebuild lmdb-queue. Or install with '--build-from-source'.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
nanrequiredNative addon abstraction for Node.js
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
lmdb-queue — npm install lmdb-queue · libregistry