A simple route system made with Node to use with Amqp protocol.
const { AmqpRouter } = require("AmqpRouter");
AmqpRouter.add("your.route", (message, channel) => {
// your handler here
});
AmqpRouter.add("your.route", "YourController.yourAction");
On your controller, you have access to the message and channel object. Example:
"use strict";
class YourController {
async yourAction({ message, channel }) {
// your handler here
}
}
module.exports = YourController;
In your AMQP (RabbitMQ) Server, enter the following code:
AmqpRouter.resolve(msg, channel);