Registry / messaging / ampq
library2019.5.11jsnpmunverified

A lightweight message queue library for Node.js providing AMPQ-style functionality. Version 2019.5.11 is currently active with infrequent releases. It offers basic publish/subscribe and work queue patterns but lacks modern AMQP protocol compliance. For full AMQP support, use amqplib.

npm install ampq
INSTALL
IMPORT
SIG · AMPQ
A
ampq
messagingjavascriptv2019.5.11
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
import mq from 'ampq'
const mq = require('ampq').default
ESM default import works cleanly; avoid .default in CommonJS.
connect
import { connect } from 'ampq'
const { connect } = require('ampq')
Named export available, though using default is more common.
default (require)
const mq = require('ampq')
CommonJS require returns the default export.

Shows basic connection, queue assertion, and message publishing in an async/await pattern.

import mq from 'ampq'; async function main() { const connection = await mq.connect('amqp://guest:guest@localhost:5672'); const channel = await connection.createChannel(); await channel.assertQueue('test'); await channel.sendToQueue('test', Buffer.from('Hello')); console.log('Message sent'); await channel.close(); await connection.close(); } main().catch(console.error);
Debug
Known issues
gotchaUnstable API: breaking changes between minor versions; pin exact version.
fix
Use exact version in package.json, e.g., "2019.5.11".
affects: >=2019.0.0
breakingNo reconnection logic: connection drop causes unhandled promise rejections.
fix
Implement manual reconnection with backoff or use amqplib.
affects: *
deprecated.on('error') deprecated in favor of channel.on('close') for errors.
fix
Use channel.on('close', () => { ... }) instead.
affects: >=2019.4.0
Errors
Common errors & fixes
Error: Cannot find module 'ampq'
Package not installed or typo in name.
fix
Run 'npm install ampq' and ensure the name is correct (ampq, not amqp).
TypeError: mq.connect is not a function
Wrong import style (using named import when default is needed).
fix
Use 'import mq from 'ampq'' or 'const mq = require('ampq')'.
Error: connect ECONNREFUSED 127.0.0.1:5672
RabbitMQ server not running or connection refused.
fix
Start RabbitMQ: 'rabbitmq-server' or 'docker run -d --hostname rmq -p 5672:5672 rabbitmq'.
Upgrade
Version history
2019.5.11latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
1
Resources
packageampq
ampq — npm install ampq · libregistry