local-mq
v1.0.4
Published
simple local message queue using event emitter
Downloads
3
Readme
Local MQ
simple local message queue using event emitter.
you can use this library for mocking mqtt or amqp.
Install
$npm i local-mq
Usage
- import library
- call
getInstance()
- call
subscribe()
,publish()
const localMQ = require('local-mq');
const mq = localMQ.MQ.getInstance();
const event = {
key: 'session.created',
args: {
name: 'vincent',
role: 'prototype.engineer',
}
}
mq.subscribe('session.#', async(ev) => console.log(ev));
mq.subscribe('session.created', async(ev) => console.log(ev));
mq.publish(event);