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 🙏

© 2025 – Pkg Stats / Ryan Hefner

azure-functions-rabbitmq-extension

v1.1.1

Published

A RabbitMQ extension for Azure Functions that allows you to easily consume messages from RabbitMQ queues

Readme

Azure Functions RabbitMQ Extension

A RabbitMQ extension for Azure Functions that allows you to easily consume messages from RabbitMQ queues.

Installation

npm install azure-functions-rabbitmq-extension

Usage

Basic Consumer

import "azure-functions-rabbitmq-extension";
import { app, InvocationContext } from "@azure/functions";

app.rabbitmq("BasicConsumer", {
  queueName: process.env.RabbitMQQueueName ?? "myQueue",
  connectionStringSetting: "RabbitMQConnectionString",
  handler: async (message: any, context: InvocationContext) => {
    context.log(`Received message: ${JSON.stringify(message)}`);
    
    // Your processing logic here
    await processMessage(message);
    
    context.log("Message processed successfully");
  }
});

async function processMessage(message: any): Promise<void> {
  // Simulate some work
  await new Promise(resolve => setTimeout(resolve, 100));
  console.log("Processing:", message);
}

Advanced Consumer with Error Handling

import "azure-functions-rabbitmq-extension";
import { app, InvocationContext } from "@azure/functions";
import { ErrorAction } from "azure-functions-rabbitmq-extension/dist/types";

app.rabbitmq("AdvancedConsumer", {
  queueName: "orders",
  connectionStringSetting: "RABBITMQ_CONNECTION_STRING",
  durable: true,
  prefetch: 2,
  maxRetries: 5,
  deadLetterQueue: "orders.dlq",
  handler: async (order: Order, context: InvocationContext, metadata) => {
    context.log(`Processing order: ${order.id}`);
    
    // Your order processing logic
    await validateOrder(order);
    await processPayment(order);
    await updateInventory(order);
  },
  onError: async (error, message, context, metadata) => {
    context.error(`Error processing message: ${error.message}`);
    
    // Decide what to do based on the error
    if (error.message.includes('validation')) {
      // Invalid message, send to DLQ
      return ErrorAction.NACK_DLQ;
    } else {
      // Transient error, retry
      return ErrorAction.NACK_REQUEUE;
    }
  }
});

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | queueName | string | - | Name of the queue to consume from | | connectionStringSetting | string | - | Name of environment variable containing connection string | | handler | MessageHandler | - | Function to handle incoming messages | | durable | boolean | true | Queue durability (survives broker restart) | | prefetch | number | 1 | Number of messages to prefetch | | autoAck | boolean | false | Auto-acknowledge messages | | pollingInterval | number | 1000 | Polling interval for health checks | | maxRetries | number | 3 | Max retry attempts before sending to DLQ | | retryDelay | number | 5000 | Delay between retries | | deadLetterQueue | string | {queueName}.dlq | Dead letter queue name | | deadLetterExchange | string | '' | Dead letter exchange name | | messageTTL | number | 0 | Message TTL in milliseconds | | maxPriority | number | 0 | Maximum message priority | | logging | boolean | true | Enable logging | | onError | ErrorHandler | - | Custom error handler | | onConnected | () => void | - | Connection established callback | | onDisconnected | () => void | - | Connection lost callback |

Environment Variables

Make sure to set the RabbitMQ connection string in your environment:

RABBITMQ_CONNECTION_STRING=amqp://username:password@host:port

Examples

Check out the examples directory for more detailed usage examples:

Contributing

See CONTRIBUTING.md for details on how to contribute to this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.