smq-rabbitmq-queue
v1.0.19
Published
simple wrapper for rabbitmq or redis-smq with multiple consumer .
Downloads
51
Readme
simple wrapper for rabbitmq or redis-smq with multiple consumer .
use unified api for both
const conf = {
// isRabbitMQ: true // use rabbitmq without this is use redis
QueueName: 'amqp_queue',
DB: 0,
host: '127.0.0.1',
port: 6379,
password: '123456',
}
const messageHandler = async (payload) => {
console.log(payload)
}
const q = new QueuePipe(conf);
await q.setConsumer(messageHandler)
const q = new QueuePipe(conf); // same conf as consumer
const prod = await q.getProducer()
prod.publish({
// payload
})