configuration based ampq message handling
❗️Still in development
npm install herrmannplatz/rabbitly
Place a rabbitly.yaml
in the root of you project.
version: 1
host: amqp://localhost
exchange:
name: logs
queues:
errors:
routingKey: logs.error
handler: handler.errors
json: true
If you prefer editor support when writing your configuration, reference the schema in your configuration file and install YAML vscode extension
# yaml-language-server: $schema=node_modules/rabbitly/schema.json
version: 1
host: ${RABBITMQ_URI}
exchange:
name: logs
Specify the handler file handler.js
with exports the specified handler functions.
module.exports.errors = async (message) => {
console.error('💥', message)
}
Run it.
{
"scripts": {
"start": "rabbitly"
}
}