@frankvdb/node-red-contrib-amqp
v1.16.0
Published
RabbitMQ nodes for node-red
Downloads
792
Readme
Node-RED Contrib AMQP
This repository provides a set of Node-RED nodes for interacting with RabbitMQ and other AMQP-compliant message brokers. It is a fork of @Stormpass/node-red-contrib-amqp, adapted to work with modern RabbitMQ features like Quorum Queues.
Features
- AMQP In: Consume messages from a queue.
- AMQP Out: Publish messages to an exchange.
- AMQP In Manual Ack: Consume messages with manual acknowledgment.
- Dynamic Virtual Host: Change the vhost at runtime for the
amqp-outnode by settingmsg.vhost. - Reconnect Support: Supports automatic reconnect behavior and input-triggered reconnect calls for inbound nodes.
Prerequisites
- Node.js 20 or newer
- Node-RED 4.0 or newer
Installation
You can install the nodes using the Node-RED Palette Manager or by running the following command in your Node-RED user directory (typically ~/.node-red):
npm install @frankvdb/node-red-contrib-amqpUsage
After installation, the following nodes will be available in your Node-RED editor:
amqp-inamqp-outamqp-in-manual-ackamqp-broker(configuration node)
For more detailed information, please see the Node Help section in the Node-RED editor.
Runtime Message Controls
The nodes support runtime control via msg:
amqp-outmsg.routingKey: overrides routing key when node routing key mode isstr.msg.vhost: changes virtual host at runtime and reconnects with the new vhost.msg.properties: AMQP message properties merged over configured JSON properties.
amqp-inandamqp-in-manual-ackmsg.payload.reconnectCall = true: triggers reconnect logic from a flow.
amqp-in-manual-ackmsg.manualAck.ackMode: explicit ack mode (ack,ackAll,nack,nackAll,reject).msg.manualAck.requeue: used bynack,nackAll, andreject(defaults totrue).- The node keeps the original AMQP message mapped by
deliveryTag, so manual acknowledgment can operate correctly after flow processing.
Examples
Sample flows are provided in examples/:
| Example | Purpose |
|---|---|
| AMQP General Usage.json | Direct, topic, fanout, and headers exchange basics. |
| AMQP Out With RPC Pattern.json | Request/response messaging using AMQP RPC pattern. |
| Manual Ack With Complete.json | Manual ack flow using a complete-trigger pattern. |
| Manual Ack With Links.json | Manual ack flow using link nodes. |
| Manual NAck With Links.json | Manual nack/requeue/dead-letter control patterns. |
Operational Notes
Health Endpoint
The broker config node exposes /amqp-broker/health from Node-RED admin HTTP:
- Returns HTTP
200when all known brokers are connected. - Returns HTTP
503when one or more brokers are not connected.
Example response:
{
"overallStatus": "healthy",
"brokers": [
{
"id": "broker-node-id",
"name": "Primary RabbitMQ",
"status": "connected"
}
]
}Troubleshooting
- Reconnect loops:
- Verify host/port/TLS/vhost values and broker reachability.
- Check whether
reconnectOnErroris enabled when desired.
- Login or permission errors:
- Confirm credentials and vhost access rights on the broker.
- Queue type mismatch:
- Ensure producer/consumer agree on queue type (
quorumvsclassic) and queue arguments.
- Ensure producer/consumer agree on queue type (
- RPC timeouts:
- Verify consumer sends replies using
replyToandcorrelationId. - Increase
rpcTimeoutMillisecondsfor slower consumers.
- Verify consumer sends replies using
Migration Notes
When importing older flows, ensure node configs include current fields:
amqp-out:exchangeRoutingKeyType,waitForConfirms,reconnectOnErroramqp-inandamqp-in-manual-ack:queueType,queueArguments- JSON fields such as
headersshould be valid JSON strings (for example"{}").
Development
To contribute to the development of these nodes, please follow these steps:
Clone the repository:
git clone https://github.com/frankvdb7/node-red-contrib-amqp.git cd node-red-contrib-amqpInstall dependencies:
npm installBuild the project:
npm run build
Development Scripts
npm start: Watch for changes and automatically rebuild.npm run build: Compile the TypeScript source code.npm run build:production: Build without source maps.npm run copyassets: Copy node editor HTML and icons into the build output.npm run lint: Format code and check for linting errors.npm test: Run the test suite.npm run test:watch: Run tests in watch mode.npm run test:cov: Generate a test coverage report.
Testing Notes
- The test suite currently has known pre-existing failures.
- Changes should not add new test failures.
- For Node-RED node tests, prefer helper event assertions (for example
node.on('call:error', ...)) over direct Sinon stubs on node methods to avoid instrumentation conflicts.
Contributing
Contributions are welcome! Please open an issue or pull request to discuss any changes.
License
ISC
