bugs-q

0.0.2 • Public • Published

bugs-q

A RabbitMQ JavaScript client library. Because amqplib didn't look particularly appealing out of the box.

Installation

npm install --save bugs-q

Usage

Publishing

const { RabbitMQChannel } = require('bugs-q');

const publishingChannel = new RabbitMQChannel('amqp://localhost');
const queue = await publishingChannel.queue('example');
await queue.publish('hello world');

Consuming

const { RabbitMQChannel } = require('bugs-q');

const consumingChannel = new RabbitMQChannel('amqp://localhost');
const queue = await consumingChannel.queue('example');
await queue.consume(async (message) => {
    console.log('got a new message', message.content.toString());
    await queue.acknowledge(message);
});

Note: don't publish and consume using the same instance of a channel.

See examples for more usage scenarios.

License

Apache License Version 2.0

Readme

Keywords

Package Sidebar

Install

npm i bugs-q

Weekly Downloads

2

Version

0.0.2

License

Apache-2.0

Unpacked Size

17 kB

Total Files

6

Last publish

Collaborators

  • tombailey