Registry / messaging / moleculer-rabbitmq-extend-delay

moleculer-rabbitmq-extend-delay

JSON →
library1.1.12jsnpmunverified

Moleculer RabbitMQ is a task queue mixin for Moleculer microservices, integrating RabbitMQ (AMQP) to offload synchronous actions to background queues. Version 1.1.x is current and stable; the package provides automatic generation of async action variants, supports configurable queue options (durability, prefetch, noAck), and offers two retry strategies: RabbitMQ requeue and delayed message exchange plugin. It requires a running RabbitMQ instance and the rabbitmq-delayed-message-exchange plugin for scheduled retries. Compared to other Moleculer queue plugins, it focuses on simplicity and direct AMQP integration without additional broker dependencies.

npm install moleculer-rabbitmq-extend-delay
INSTALL
IMPORT
SIG · MOLECULER-RABBITMQ
M
moleculer-rabbitmq-extend-delay
messagingjavascriptv1.1.12
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 QueueMixin = require('moleculer-rabbitmq');
import QueueMixin from 'moleculer-rabbitmq';
Package does not ship ESM exports; CommonJS require() is the only supported import style.
QueueMixin
const QueueMixin = require('moleculer-rabbitmq');
import { QueueMixin } from 'moleculer-rabbitmq';
Package exports a single function as default, not a named export.
Options type
/** @type {import('moleculer-rabbitmq').MoleculerRabbitMQOptions} */
TypeScript definitions are not provided; use JSDoc or create own types.

Creates a Moleculer service with RabbitMQ queue mixin, defines a queued action, and calls its async variant.

const { ServiceBroker } = require('moleculer'); const QueueMixin = require('moleculer-rabbitmq'); const broker = new ServiceBroker(); broker.createService({ name: 'worker', mixins: [QueueMixin({ connection: process.env.AMQP_URL ?? 'amqp://localhost', asyncActions: true, })], actions: { process: { queue: { amqp: { queueAssert: { durable: true }, consume: { noAck: false }, prefetch: 1 } }, params: { data: 'string' }, async handler(ctx) { console.log(`Processing: ${ctx.params.data}`); return `done ${ctx.params.data}`; }, }, }, }); broker.start().then(() => { broker.call('worker.process.async', { params: { data: 'test' }, options: { timeout: 5000 } }); });
Debug
Known issues
gotchaasyncActions: true automatically exposes .async versions of all actions, which can inadvertently expose internal actions.
fix
Disable asyncActions and manually configure queue per action.
affects: >=1.0.0
gotchaUsing retry: true without rabbitmq-delayed-message-exchange plugin causes infinite requeue loops.
fix
Set retry: false or install and configure the delayed message exchange plugin.
affects: >=1.0.0
breakingThe option name 'retryExchangeAssert' was introduced in v1.1.0; older versions used different option names.
fix
Upgrade to v1.1.0+ or check the changelog for migration.
affects: <1.1.0
deprecatedMoleculer v0.14 is the last supported major version; Moleculer v1.x may not be compatible.
fix
Stay on Moleculer 0.14.x or test compatibility.
affects: >=0.15.0-alpha
Errors
Common errors & fixes
Error: Cannot find module 'moleculer-rabbitmq'
Package not installed or import path wrong.
fix
Run 'npm install moleculer-rabbitmq' and ensure require path is correct.
TypeError: QueueMixin is not a function
Incorrect import; package exports a factory function, not an object.
fix
Use 'const QueueMixin = require('moleculer-rabbitmq');' then invoke as QueueMixin(opts).
Error: connect ECONNREFUSED 127.0.0.1:5672
RabbitMQ server not running or connection string wrong.
fix
Start RabbitMQ or set AMQP_URL environment variable to correct URI.
Upgrade
Version history
1.1.12latest on npm
Audit
Dependencies
moleculerrequiredPeer dependency; required to use mixins and service definitions.
Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
moleculer-rabbitmq-extend-delay — npm install moleculer-rabbitmq-extend-delay · libregistry