dw-rabbitmq
v1.0.6
Published
RabbitMQ module for Digital Wallet
Downloads
7
Readme
Module created to handle communication with a RabbitMQ server.
Example:
//To get the service up and running
const {RabbitMQService} = require('dw-rabbitmq');
const rabbitmq = new RabbitMQService('amqp://localhost');
await rabbitmq.start();
//publishes a message to an exchange/routing key
await rabbitmq.publish('Content message', 'exchange', 'routing-key');
//callback signature for a consumer function
function consumerCallback(payload, ack){
//Does some stuffs with the payload
...
ack(true); //acknowledge the message on RabbitMQ Server
}
//set a consumer callback on a specific exchange/routing key
await rabbitmq.consume('exchange', 'routing-key', consumerCallback);