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

@message-in-the-middle/pipe-adapters-rabbitmq

v0.1.2

Published

RabbitMQ (AMQP) adapter for message pipeline orchestration

Readme

@message-in-the-middle/pipe-adapters-rabbitmq

⚠️ Work in Progress Is this library production-ready? No. Is this library safe? No. When will it be ready? Soon™ (maybe tomorrow, maybe never). Why is it public? Experiment

message-in-the-middle is to Express.js what your message queue processing is to HTTP request processing. Just as Express provides a middleware pattern for HTTP requests, this library provides a middleware pattern for processing queue messages.

Why This Exists

Processing queue messages usually means copy-pasting the same boilerplate: parse JSON, validate, log, retry, deduplicate, route to handlers. This library lets you compose that logic as middlewares.


RabbitMQ (AMQP) adapter for message pipeline orchestration

Queue adapter implementation for RabbitMQ, enabling pipeline orchestration with RabbitMQ queues and exchanges.

Installation

npm install @message-in-the-middle/pipe-core @message-in-the-middle/pipe-adapters-rabbitmq amqplib
npm install --save-dev @types/amqplib

Quick Start

import { MessagePipelineOrchestrator } from '@message-in-the-middle/pipe-core';
import { RabbitMQPipeAdapter } from '@message-in-the-middle/pipe-adapters-rabbitmq';

const pipeline = new MessagePipelineOrchestrator()
  .source('orders', new RabbitMQPipeAdapter({
    connection: 'amqp://localhost',
    queue: 'orders',
    prefetch: 10,
  }))
  .pipe('process', processOrder)
  .destination('processed', new RabbitMQPipeAdapter({
    connection: 'amqp://localhost',
    queue: 'processed-orders',
    exchange: 'orders-exchange',
    routingKey: 'order.processed',
  }))
  .start();

Features

  • ✅ Multiple exchange types (direct, topic, fanout, headers)
  • ✅ Prefetch (QoS) control
  • ✅ Queue and exchange assertion
  • ✅ Message priority and TTL support
  • ✅ Dead letter exchange configuration
  • ✅ Connection sharing across adapters
  • ✅ Manual acknowledgment support

API

RabbitMQPipeAdapter Options

interface RabbitMQPipeAdapterOptions {
  connection: Connection | string | Options.Connect; // Required
  queue: string;                          // Required: Queue name
  name?: string;                          // Optional: Custom adapter name
  exchange?: string;                      // Optional: Exchange name (default: '')
  routingKey?: string;                    // Optional: Routing key (default: queue name)
  queueOptions?: Options.AssertQueue;     // Optional: Queue assertion options
  exchangeOptions?: Options.AssertExchange; // Optional: Exchange assertion options
  prefetch?: number;                      // Default: 10
  noAck?: boolean;                        // Default: false (manual ack)
  assertQueue?: boolean;                  // Default: true
  assertExchange?: boolean;               // Default: false
  logger?: Logger;                        // Optional: Logger instance
}

Example with Exchange

const adapter = new RabbitMQPipeAdapter({
  connection: 'amqp://localhost',
  queue: 'orders',
  exchange: 'orders-exchange',
  routingKey: 'order.created',
  exchangeOptions: {
    type: 'topic',
    durable: true,
  },
  queueOptions: {
    durable: true,
    arguments: {
      'x-message-ttl': 86400000,          // 24 hours TTL
      'x-dead-letter-exchange': 'dlx',    // Dead letter exchange
    },
  },
  prefetch: 10,
  logger: console,
});

Advanced Features

Connection Sharing

Share a single connection across multiple adapters:

import * as amqp from 'amqplib';

const connection = await amqp.connect('amqp://localhost');

const sourceAdapter = new RabbitMQPipeAdapter({
  connection,  // Shared connection
  queue: 'source-queue',
});

const destAdapter = new RabbitMQPipeAdapter({
  connection,  // Same connection
  queue: 'dest-queue',
});

Message Priority

await adapter.send(message, {
  custom: {
    priority: 10,  // 0-10, higher = more priority
  },
});

Message TTL

await adapter.send(message, {
  custom: {
    expiration: '60000',  // 60 seconds (string!)
  },
});

Examples

See examples/pipelines for complete examples:

  • rabbitmq-to-rabbitmq-simple.ts - Basic RabbitMQ → RabbitMQ pipeline
  • cross-queue-sqs-to-rabbitmq.ts - Cross-queue integration

Docker Setup

For local development and testing:

# docker-compose.yml
version: '3.8'
services:
  rabbitmq:
    image: rabbitmq:3-management
    ports:
      - '5672:5672'
      - '15672:15672'
    environment:
      RABBITMQ_DEFAULT_USER: guest
      RABBITMQ_DEFAULT_PASS: guest
docker-compose up -d

License

MIT