adonisjs-rabbitmq
v0.0.2
Published
AdonisJS RabbitMQ provider
Downloads
39
Readme
adonisjs-rabbitmq
Installation
In order to install, run the following command:
adonis install adonisjs-rabbitmq
After that, add RabbitMQProvider to the list of providers on start/app.js
:
const providers = [
....,
'adonisjs-rabbitmq/providers/RabbitMQProvider'
]
You also need to add a configuration to config/queues.js
:
'use strict'
const Env = use('Env')
module.exports = {
driver: 'rabbitmq',
rabbitmq: {
url: Env.get('RABBIT_MQ_URL', 'amqp://<username>:<password>@<host>:<port>/<vhost>')
}
}
Usage
Producer
In order to use the producer, you must require it on the code:
const RabbitMQProducer = use('RabbitMQ/Queue/Producer')
To publish something to Rabbit:
RabbitMQProducer.publish(exchange, routingKey, content)