Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

tombailey/bugs-q

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published