kane-queue
v0.2.1
Published
[![Known Vulnerabilities](https://snyk.io/test/npm/kane-queue/badge.svg)](https://snyk.io/test/npm/kane-queue)
Downloads
9
Readme
kane-queue
This small repo has 2 goals:
- Pop up a dockerized RabbitMQ server for dev only purposes
- Serves an AMQP client through a NPM package.
NPM package
Warning: the NPM package is for internal usage only and was adapted to our setup!
Install the package: yarn add kane-queue
. The returned object will used the "amqplib" API.
Usage:
const kaneQueue = require("kane-queue");
// in this example we create a publisher and one subscriber to a "new user" event
const content = {/* user properties */};
const myID = 42;
async function pub () {
await kaneQueue.publish(
{
exchange: "amq.topic"
},
"user.created",
content
);
}
async function sub () {
await kaneQueue.consume(
{
exchange: "amq.topic",
queue: "created-user-" + myID,
topics: ["user.created"]
},
function (newUser) {
console.log("User created:", newUser);
}
);
}
Management
Once you've launched the server with docker-compose up -d
you can visit localhost:15672 and log to the admin panel
using "guest/guest".