npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gibme/rabbitmq

v22.0.1

Published

A simplified, event-driven RabbitMQ client library for Node.js

Readme

@gibme/rabbitmq

A simplified, event-driven RabbitMQ client library for Node.js with TypeScript support.

Provides request/reply (RPC) and publish/subscribe messaging patterns with automatic reconnection.

Documentation

https://gibme-npm.github.io/rabbitmq/

Requirements

  • Node.js >= 22
  • RabbitMQ server

Installation

npm install @gibme/rabbitmq

or

yarn add @gibme/rabbitmq

Quick Start

import RabbitMQ from "@gibme/rabbitmq";

const client = new RabbitMQ({
    host: "localhost",
    user: "guest",
    password: "guest",
});

await client.connect();

Connection Options

| Option | Type | Default | Description | |---|---|---|---| | host | string | required | RabbitMQ server hostname | | port | number | 5672 | Server port | | user | string | | Authentication username | | password | string | | Authentication password | | virtualHost | string | | Virtual host path | | autoReconnect | boolean | true | Automatically reconnect on disconnection | | query | string | | Connection query string parameters |

Usage

Request / Reply (RPC)

Send a message and wait for a response from a consumer:

import RabbitMQ from "@gibme/rabbitmq";

interface Payload {
    data: number;
}

const client = new RabbitMQ({ host: "localhost" });
await client.connect();

const queue = "rpc-queue";
await client.createQueue(queue);

// Set up the consumer (worker)
client.on<Payload>("message", async (q, message, payload) => {
    if (q === queue) {
        await client.reply(message, { data: payload.data + 1 });
    } else {
        await client.nack(message);
    }
});

await client.registerConsumer(queue);

// Send a request and await the reply
const reply = await client.requestReply<Payload, Payload>(queue, { data: 10 }, 15_000);
console.log(reply.data); // 11

Publish / Subscribe (Worker Queue)

Push messages to a queue for processing by consumers:

import RabbitMQ from "@gibme/rabbitmq";

interface Job {
    task: string;
}

const client = new RabbitMQ({ host: "localhost" });
await client.connect();

const queue = "work-queue";
await client.createQueue(queue);

// Set up the consumer
client.on<Job>("message", async (q, message, payload) => {
    if (q === queue) {
        console.log("Processing:", payload.task);
        await client.ack(message);
    } else {
        await client.nack(message);
    }
});

await client.registerConsumer(queue);

// Publish a message
await client.sendToQueue(queue, { task: "process-image" });

Events

| Event | Listener Signature | Description | |---|---|---| | connect | () => void | Fired when connected to RabbitMQ | | disconnect | (error: Error) => void | Fired on disconnection | | message | (queue: string, message: Message, payload: T) => void | Fired when a message is consumed | | log | (entry: Error \| string) => void | Informational logging (reconnection events, etc.) |

API

Connection

  • connect(): Promise<void> - Connect to the RabbitMQ server
  • close(): Promise<void> - Close the connection
  • connected: boolean - Whether the connection is active

Queue Management

  • createQueue(queue, durable?, exclusive?): Promise<void> - Create a queue
  • deleteQueue(queue): Promise<void> - Delete a queue

Consumer Management

  • registerConsumer<T>(queue, prefetch?): Promise<string> - Register a consumer, returns a consumer tag
  • cancelConsumer(consumerTag): Promise<void> - Cancel a consumer
  • prefetch(count): Promise<void> - Set the channel prefetch count

Messaging

  • sendToQueue<T>(queue, payload, options?): Promise<boolean> - Send a message to a queue
  • requestReply<T, R>(queue, payload, timeout?, useOneTimeQueue?): Promise<R> - Send a request and wait for a reply (RPC)
  • reply<T>(message, payload, noAck?, requeue?): Promise<boolean> - Reply to a received message
  • ack(message): Promise<void> - Acknowledge a message
  • nack(message, requeue?): Promise<void> - Negative-acknowledge a message

License

MIT